Set the prompt.
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
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_profilePS1="{${HOSTNAME}"':${PWD}}'
export PS1However 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
Quoted 9 lines · Edward Parrilla
Hi all,
I have created this line in my .bash_profilePS1="{${HOSTNAME}"':${PWD}}'
export PS1However 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
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_profilePS1="{${HOSTNAME}"':${PWD}}'
export PS1However 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
Quoted 9 lines · Scott Taylor
Quoted 3 lines · Edward Parrilla
PS1="{${HOSTNAME}"':${PWD}}'
export PS1Try:
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
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 PS1Try:
man bash
Look for PROMPTING
/PROMTINGQuoted 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
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]>