It[s really important to code the HISTFILE relative to each user:
export HISTFILE=$HOME/.sh_history
As has been mentioned several times in the HP-UX forums, / is a very, very bnad place to have root's $HOME directory. And if HISTFILE=.sh_history, it will only work when you are in the $HOME directory...some root profiles may cd somewhere else...
And you might as well setup a size and an editor:
export HISTSIZE=500
export EDITOR=/usr/bin/vi
Put these lines in /etc/profile and everyone will have .sh_history setup. NOTE: root is unique in that if $HOME/.sh_history does NOT already exist, it will not be created (other users will have .sh_history created though). Just do this as root:
touch $HOME/.sh_history
Now, everything will work--UNLESS you are using Xwindows. Unfortunately, Xwindows defaults to NO /eetc/profile and NO .profile execution for local terminal emulators such as xterm, hpterm and dtterm. To fix this:
echo "*loginShell:true" >> $HOME/.Xdefaults
This solves the rather crazy CDE method of specifying DTSOURCEPROFILE which is only half correct (never sources /etc/profile, only .profile). The loginShell setting makes the terminal emulators work like all classic telnet or ssh logins.
Note also that just typing these variables on the command line won't enable the shell history. It has to be set during /etc/profile or .profile execution.
Bill Hassell, sysadmin