That would at least get your location in the Unix prompt string. To avoid having to set this variable each time you login, you could set the variable in your .profile.
As far as the system name you should be able to include uname in the above string as follows:
PS1="'uname -n' \$PWD =>"
However, I've actually not been able to successfully include my system name using the above way, anyone have an answer to that?
add to profile the following:
export HOST=`/usr/bin/uname -n`
export USER=`/usr/bin/id -nur`
export PS1='$USER@$HOST: $PWD >'
Note the single quotes. The first two lines have the "backward" ones and the last line has the usual ones. I put a space between the colon after the host name and the $PWD so I can double-click a path and paste it when I'm using an xterm.
I've never understood why having at least the $PWD in the PS1 isn't the default, especially for root.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.