Skip to contentSkip to conversation

Set the prompt.

DISCUSSION Edward Parrilla 4 participants 7 messages Nov 3, 2004 – Nov 4, 2004 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi all,
I have created this line in my .bash_profile

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

However when I initiate my term session it does not show the host name, nor the PWD.
What could be wrong?
Regards
Ed

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Try
PS1="\h \w"
export PS1
That will do the trick, but it looks like something not so nice. PS1="\h \w $ "
is a bit better. :)

Quoted 17 lines · Edward Parrilla

Hi all,
I have created this line in my .bash_profile

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

However when I initiate my term session it does not show the host name, nor the PWD.
What could be wrong?
Regards
Ed

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Edward Parrilla
Quoted 9 lines · Edward Parrilla

Hi all,
I have created this line in my .bash_profile

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

However when I initiate my term session it does not show the host name, nor the PWD.
What could be wrong?

Probably.

Try:

man bash

I get:
PS1="\h:\W "
to get the output you desire. Your way looks more like the old Korn Shell (ksh), almost.

I like: PS1="[\u@\h \W]\\$ " (RH default, something they did right. ;)

--
Scott

#4 lore raw

No, Edward wanted pwd as the prompt.
\W provides only the open folder, not full path. (which \w is).

Quoted 36 lines · Scott Taylor
Quoted 9 lines · Edward Parrilla

Hi all,
I have created this line in my .bash_profile

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

However when I initiate my term session it does not show the host name, nor the PWD.
What could be wrong?

Probably.

Try:

man bash

I get:
PS1="\h:\W "
to get the output you desire. Your way looks more like the old Korn Shell (ksh), almost.

I like: PS1="[\u@\h \W]\\$ " (RH default, something they did right. ;)

--
Scott

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Scott Taylor
Quoted 9 lines · Scott Taylor
Quoted 3 lines · Edward Parrilla

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

Try:

man bash

Look for PROMPTING
/PROMTING

Quoted 2 lines

I get:
PS1="\h:\W "

Sorry, that should be lower case 'W' "\h:\w " to get a full PWD with ~/ to represent your home directory, but it gets very long that way.

--
Scott

#6 lore raw

Hi,
thanks for your answer. I found that what I have set works but when I logging through X-Window session; however it does not work if I go through an X-term or Term session.
What is the difference.
Thanks
Edward

Quoted 26 lines · Scott Taylor
Quoted 9 lines · Scott Taylor
Quoted 3 lines · Edward Parrilla

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

Try:

man bash

Look for PROMPTING
/PROMTING

Quoted 2 lines

I get:
PS1="\h:\W "

Sorry, that should be lower case 'W' "\h:\w " to get a full PWD with ~/ to represent your home directory, but it gets very long that way.

--
Scott
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 4 lines · Edward Parrilla

thanks for your answer. I found that what I have set works but when I logging through X-Window session; however it does not work if I go through an X-term or Term session.
What is the difference.

Some of the startup files (e.g. ~/.profile, ~/.bash_profile, ~/.bash_login, /etc/profile) are only read for "login" shells.

By default, xterm doesn't run a login shell. You can make it do so by adding the "-ls" switch, setting the loginShell X resource, or by explicitly specifying the -l switch to bash, e.g. "xterm -e bash -l".

Alternatively, you could put the commands into ~/.bashrc instead; that is read for all interactive shells, not just login shells.

The main reason for the distinction is that environment variables only need to be set once, then they will be inherited by all child processes. If an environment variable is set based upon its previous value (e.g. "PATH=/usr/local/bin:$PATH ; export PATH"), and you were to do this in ~/.bashrc, the change would be made again every time you started a subshell.

Signature · 1 line
Glynn Clements <[email protected]>