Discussion:
PS1
(too old to reply)
Ivan Shmakov
2013-02-09 19:11:18 UTC
Permalink
[Cross-posting to news:alt.comp.lang.shell.unix.bourne-bash.]
[04:46:03][localhost:/home/aragorn] [0][aragorn][$] >
What an evil PS1 you have! What mean those '[0]' and '[$]' in second
line?
The last command's exit code and \$, I guess?
p. s. I have PS1 like this too. But it's for logins with no
$DISPLAY.
FWIW, I'm using a simpler prompt:

PS1='${debian_chroot:+($debian_chroot) }[\u@\h] \W\$ '

Or, should I need timestamps:

PS1='${debian_chroot:+($debian_chroot) }[\u@\h] $(printf x%08x "$(date +%s)") \W\$ '

\W is quite apt for me, given that I may occasionally have to
visit something like /home/public/users/ivan/download/svn-sync/,
or /home/private/users/ivan/private/slides/debian-apt-2012/.
--
FSF associate member #7257
Aragorn
2013-02-10 02:12:42 UTC
Permalink
On Saturday 09 February 2013 20:11, Ivan Shmakov conveyed the following
to comp.os.linux.misc...
Post by Ivan Shmakov
[Cross-posting to news:alt.comp.lang.shell.unix.bourne-bash.]
[04:46:03][localhost:/home/aragorn] [0][aragorn][$] >
What an evil PS1 you have! What mean those '[0]' and '[$]' in
second line?
The last command's exit code and \$, I guess?
Not the exit code but the number of the tty. In an X11 terminal
session, it's only a number, because those are pseudo-terminal slaves.
In character mode sessions, it prints e.g. "tty1".
Post by Ivan Shmakov
p. s. I have PS1 like this too. But it's for logins with no
$DISPLAY.
\W is quite apt for me, given that I may occasionally have to
visit something like /home/public/users/ivan/download/svn-sync/,
or /home/private/users/ivan/private/slides/debian-apt-2012/.
That's why I have the $PS1 split out over two lines. That way, I can
always see the full path without that it consumes screen space I could
use for typing commands. :-)

I also have a newline ("\") at the beginning of the $PS1, so that
there's always a blank line between the output of the last command and
the prompt, which makes it easier for me to read.
--
= Aragorn =
(registered GNU/Linux user #223157)
Aragorn
2013-02-10 02:14:58 UTC
Permalink
On Sunday 10 February 2013 03:12, Aragorn conveyed the following to
comp.os.linux.misc...
I also have a newline ("\") at the beginning of the $PS1 [...]
^^^^^

That should read "\n", of course. ;-)
--
= Aragorn =
(registered GNU/Linux user #223157)
Loading...