David Champion wrote:
> 
> It says "uname: not super user" because uname(2) is the syscall that
> sets the hostname.
> 
> Just use uname -n on all operating systems, and don't trouble yourself
> with the switch. "uname -n" returns the nodename. The nodename is the
> "real" hostname, and has nothing to do with the DNS or /etc/hosts name
> that your IP address resolves to, and should not contain any dots. (If
> it does, your system setup needs adjustment.)

are you sure this is true for FreeBSD?  i find that various things
complain if i don't have "hostname" set to the fqdn (and yes, my IP and
hostname, as well as the loopback interface are in /etc/hosts).

also, the fact that the 'hostname' command in FreeBSD has a '-s' switch
(which trims off any domain information) seems to indicate that at least
some people set it this way; uname -n seems to report the same thing as
hostname:

jazz% uname -n
jazz.hq.newdream.net

i'm sure there may be a more elegant way to do this, but i trim it down
with something like like this; seems to work on most operating systems
i've tried it on (with various versions of sed) - i suppose it wouldn't
work if there were numbers in the hostname, so probably using s/\..*//g
might be better.
  
S_HOSTNAME=$(hostname | sed "s/\.[A-Za-z]*//g")

-- 
Will Yardley
input: william < @ hq . newdream . net . >

Reply via email to