$HOSTNAME includes "\n". Chomp it.
Update: Here's a way to see what's happening:
prompt$ perl -e '$HOSTNAME = `hostname -s`; print $HOSTNAME;' | od -c
In reply to Re: `hostname -s`
by keszler
in thread `hostname -s`
by joeymac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |