Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit
» 

DSPP Home

» HP STK home
Tru64 UNIX STK
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» FAQ
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
» DSPP
Content starts here

critical impact:

hostname - option unavailable (CrUn373)

CMD Impacts

Problem description

The -s option for the hostname command exists on Tru64 UNIX but not on HP-UX.

The hostname command sets or displays the name of the current host system. On Tru64 UNIX, the -s option displays the short form of the host name.

The -s option is not available on HP-UX. If a privileged user executes hostname -s on HP-UX, then hostname is set to -s. That setting lasts until the system is rebooted. If a nonprivileged user executes it, the command fails with the following error:

    You must be superuser to set the hostname

Identifiers

UNIX Command Optionshostname:-s      

See also

Solution description

Extract the short form of the host name yourself. The examples show several ways of doing this.

Be sure to check shell initialization files like .profile and .login for hostname -s -- especially the ones for root -- because they often use the command to set the shell prompt.

New behavior

# extract the short form of the host name in any shell
hostname | awk -F . '{print $1}'
hostname | cut -f 1 -d .
hostname | sed 's/\..*//'

# set a short host name prompt in the Korn and POSIX shells
host="$(hostname)"
PS1="${host%%.*}> "

# bash
PS1="\h> "

# tcsh
set prompt="%m> "

See also


Problem summary

classifications source types OS release severity type
CMD Make, Script any HP-UX 11i version critical unavailable
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.