Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change hostname from lowercase to uppercase

Status
Not open for further replies.

madra

MIS
Feb 12, 2003
95
GB
I can't find the reason as to why root won't convert the hostname to uppercase, but my ordinary ID will.

NODE="`hostname| tr [a-z] [A-Z]`"; echo $NODE

thanks,
madra


I only ask stupid questions because I'm thick
 
I dont know why is it happen, by you can use the following command:

hostname| tr 'a-z' 'A-Z'
 
that should be [tt]NODE=`tr '[a-z]' '[A-Z]'`[/tt]

And the reason [tt]root[/tt] doesn't translate is because you omitted the single quotes, resulting in the shell translating [tt][a-z][/tt] into the letter [tt]u[/tt] because in / directory (default home dir of root) there is a pathname called [tt]/u[/tt] (symlink to /home). In your homedir there probably aren't any single letter filenames or dirnames.

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top