Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hostname -I
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
zebbedi
Tux's lil' helper
Tux's lil' helper


Joined: 05 Sep 2003
Posts: 123

PostPosted: Tue Apr 28, 2015 3:08 pm    Post subject: hostname -I Reply with quote

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
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Tue Apr 28, 2015 7:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum