1833059 Members
3107 Online
110049 Solutions
New Discussion

HP-UX Prompt

 
SOLVED
Go to solution
Nelson Laracuente
Frequent Advisor

HP-UX Prompt

Good morning and please forgive my ignorance. I am new to UNIX. I just installed a refurbished RX1600 with HP-UX 11iv2 that we will be using to test and play with UNIX. I have got it configured and it connects to the network fine. However, I would like the prompt to display the servers name instead of the # prompt. Can I do this via SAM or do I have to modify a file? Thanks.
8 REPLIES 8
spex
Honored Contributor
Solution

Re: HP-UX Prompt

Hi,

# export PS1="$(hostname) # "

PCS
Peter Godron
Honored Contributor

Re: HP-UX Prompt

Nelson,
keep an eye on thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1049670

Solution is there.

Welcome to UNIX !
spex
Honored Contributor

Re: HP-UX Prompt

To make the change permanent, change the PS1=... line in the user's .profile to read:

PS1="$(hostname) # "

PCS
DCE
Honored Contributor

Re: HP-UX Prompt


Place the following line in your .profile (just your id uses it)

export PS1=`uname -n`:'$PWD`# '

also

export HISTFILE=/root/.sh_history
(assumes root home directory is /root)
V. Nyga
Honored Contributor

Re: HP-UX Prompt

@PCS

You forgot to say
'export PS1'
in .profile after setting it with PS1=...

Nelson,

note that the file to edit changes if you change the login shell (for ex. to csh).

Volkmar
*** Say 'Thanks' with Kudos ***
Nelson Laracuente
Frequent Advisor

Re: HP-UX Prompt

Thank you everyone and have an awesome day!!!
spex
Honored Contributor

Re: HP-UX Prompt

Volkmar,

By default, "export PS1" exists in ~/.profile, so there is no need to mention it.

Also, Nelson stated that his prompt is #. If he were using csh, the prompt would most likely have been %. And more than the file to edit changing under csh, the syntax of the command changes as well.

PCS
V. Nyga
Honored Contributor

Re: HP-UX Prompt

PCS - I can't see a default export - maybe 11iv2 is different to my 11iv1.
And of course changes many if you change the shell ...

Sorry Nelson, no more chat now :-)
*** Say 'Thanks' with Kudos ***