WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: output of hostname -i has an space at the end  (Read 2962 times)

Offline tm

  • Newbie
  • *
  • Posts: 1
output of hostname -i has an space at the end
« on: March 22, 2012, 11: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

Offline gutmensch

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 605
  • I can make it disappear, have no fear!
    • remembrance blog
Re: output of hostname -i has an space at the end
« Reply #1 on: March 22, 2012, 11:54:56 AM »
thx, seems to be a busybox error, reported upstream.
If I seem unduly clear to you, you must have misunderstood what I said. (Alan Greenspan)