Tiny Core Linux

Tiny Core Base => Micro Core => Topic started by: tm on March 22, 2012, 08:38:47 AM

Title: output of hostname -i has an space at the end
Post by: tm on March 22, 2012, 08:38:47 AM
Hey,

i'm using the output of hostname -i for a case and was wondering why it always gos to the default case.
It was the space at the end as you can see

~$ echo ">$(hostname -i)<"
>172.27.45.6 <

or
~$ hostname -i|od -c
0000000   1   7   2   .   2   7   .   4   5   .   6      \n
0000015

solved
hn=$(hostname -i)
hn2=${hn%% *}
and now in hn2 there are no more spaces.
~$ echo ">$hn2<"
>172.27.45.6<

i am using tc 2.1 and 4.3

kind regards
tm
Title: Re: output of hostname -i has an space at the end
Post by: gutmensch on March 22, 2012, 08:54:56 AM
thx, seems to be a busybox error, reported upstream.