Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting default prompt.

Status
Not open for further replies.

jxfish2

Technical User
Jan 24, 2002
183
0
0
US
I can set each of the following under HP-UX and Linux, but am having some difficulty under Solaris:

Default prompt:

The following entries don't work at all:

PS1="\u @ \h | \W > "

PS1="\$ID @ \$HOST | \$PWD > "

The following entries work, but the directory doesn't change when physically going to another directory. Still shows original directory.

PS1="$ID @ $HOST | $PWD > "

PS1=" `whoami` @ `uname -n` | `pwd` > "

How can I set a dynamic prompt, where the prompt will change, when changing directories?
 
I had to set the default user shell to KSH...

After doing this, everything works...

History

Prompt

Why would Sun still use an antiquated shell with such limited functionality?

Unless otherwise specified, all commands are executed with the same shell as the user running the script or program.

This is NOT a good practice, as each script should identify the shell to run in, based on what commands the script was designed to run under. In this manner, it doesn't matter what shell the individual system users are using for their default.

i.e.

The first line of any script should identify the shell to run as:

#!/usr/bin/ksh

Joe
 
I use this for bash


ESC="\033"
PROMPT='[\h:\u:$PWD]> ' # hostname
export PROMPT
STYLE='m' # plain
# PROMPT='\u' # username
# STYLE=';1m' # bold
PS1="$PROMPT "
PS2="> "


 
Suns policy is to maintain defaults acrross O/S upgrades so as not to confuse existing users etc...

Ged Jones

Top man
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top