View previous topic :: View next topic |
Author |
Message |
zebbedi Tux's lil' helper
Joined: 05 Sep 2003 Posts: 123
|
Posted: Tue Apr 28, 2015 3:08 pm Post subject: hostname -I |
|
|
I have some 3rd party scripts which use "hostname -I" (capital I) to get an ip address to bind to on ubuntu based systems. Unfortunately the version of hostname on gentoo seems to only work if it is lower case.
Is there a way i can create an alias or something so that when "hostname -I" (uppercase) runs it actually executes "hostname -i" (lowercase)? |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3131
|
Posted: Tue Apr 28, 2015 7:24 pm Post subject: |
|
|
you can workaround it for example with a wrapper script in higher-proprity PATH, e.g.
Cmd=""
while [ "$1" != "" ]
do if [ "$1" == "-I" ]
then Arg="-i"
else
Arg="$1"
fi
Cmd="$Cmd $Arg"
shift
done
/bin/hostname $Cmd
however I'm pretty sure you'd do better reporting a bug to that 3rd party provider. Also, you might consider fixing that script with sed. (replacing all occurences of hostname -I with hostname -i) so that ugly workaroung won't stick to your system. |
|
Back to top |
|
|
|