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!

Customize prompt

Status
Not open for further replies.

generaal

Programmer
Jan 11, 2007
58
0
0
ZA
I have the following text in my user's .profile file:

export PS1="$USER-`uname -n`:\$PWD#"
function go {
cd $1
PS1="`uname -n`:`pwd`# "
export PS1
export PS1="$USER-`uname -n`:\$PWD#"

Yet, whenever i login as the user, only a $ character is displayed when i open a terminal. This is frustrating as it should be an easy thing to fix, yet i just cannot get it right. If i export it manually, its fine, but onlu for that session. Can anyone help?
 
This works assuming you are using ksh (or maybe bash):

Code:
export PS1=${USER}@`uname -n`':${PWD} % '

I think you need to NOT escape ${PWD}
 
Thank you. I found the following lines in another user's .dtprofile:

export PS1="$USER-`uname -n`:\$PWD>"
export TMOUT=0
export PATH

And then:

. /etc/profile

Not sure why it worked, but when i copied that file onto the problem workstation and rebooted, it was fine afterwards.
 
The command should give you a prompt of - username-host name, and present working directory.
delete the \ in front of $PWD it is acting as an escape.
Also not sure what the function is doing there but it maybe causing problems when the profile executes.
The syntax looks wrong. It has an open brace but no close brace and the function has no arguments.

You can always test commands like this from the command line with ,echo, ie. echo "$USER-`uname -n`:$PWD#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top