Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #7285

Re: PS1

From Aragorn <stryder@telenet.be.invalid>
Newsgroups alt.comp.lang.shell.unix.bourne-bash, comp.os.linux.misc
Subject Re: PS1
Followup-To alt.comp.lang.shell.unix.bourne-bash
Date 2013-02-10 03:12 +0100
Organization A noiseless patient Strider
Message-ID <kf6vlo$73k$1@dont-email.me> (permalink)
References (6 earlier) <kf4as3$kkv$1@dont-email.me> <slrnkhbhcq.88s.ibuprofin@fermi.phx.az.us> <kf4gqt$9bu$3@dont-email.me> <slrnkhccns.t58.whynot@orphan.zombinet> <87txpl7161.fsf_-_@violet.siamics.net>

Cross-posted to 2 groups.

Followups directed to: alt.comp.lang.shell.unix.bourne-bash

Show all headers | View raw


On Saturday 09 February 2013 20:11, Ivan Shmakov conveyed the following 
to comp.os.linux.misc...

>>>>>> Eric Pozharski <whynot@pozharski.name> writes:
>>>>>> with <kf4gqt$9bu$3@dont-email.me> Aragorn wrote:
> 
> [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".

>  > 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/.

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)

Back to comp.os.linux.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Help! zsmith@gmail.com - 2013-02-05 13:59 -0800
  Re: Help! The Natural Philosopher <tnp@invalid.invalid> - 2013-02-05 22:31 +0000
    Re: Help! Matthew of Boswell <mordervomubel+usenet@lockmail.us> - 2013-02-05 20:18 -0500
      Re: Help! The Natural Philosopher <tnp@invalid.invalid> - 2013-02-06 01:39 +0000
      Re: Help! irscott@gmail.com - 2013-02-06 11:27 -0800
        Re: Help! J G Miller <miller@yoyo.ORG> - 2013-02-06 20:56 +0000
        Re: Help! "Aaron W.  Hsu" <arcfide@sacrideo.us> - 2013-02-06 22:23 -0500
        Re: Help! Matthew of Boswell <mordervomubel+usenet@lockmail.us> - 2013-02-08 17:58 -0500
  Necroposting yet again from GOOGLE groups -- Re: Help! J G Miller <miller@yoyo.ORG> - 2013-02-06 00:18 +0000
    Re: Necroposting yet again from GOOGLE groups -- Re: Help! Chick Tower <c.tower@deadspam.com> - 2013-02-06 18:58 +0000
      Re: Necroposting yet again from GOOGLE groups -- Re: Help! J G Miller <miller@yoyo.ORG> - 2013-02-06 20:54 +0000
        Re: Necroposting yet again from GOOGLE groups -- Re: Help! Matthew of Boswell <mordervomubel+usenet@lockmail.us> - 2013-02-08 17:35 -0500
        Re: Necroposting yet again from GOOGLE groups -- Re: Help! Michael Black <et472@ncf.ca> - 2013-02-08 17:46 -0500
          Re: Necroposting yet again from GOOGLE groups -- Re: Help! J G Miller <miller@yoyo.ORG> - 2013-02-09 02:01 +0000
          Re: Necroposting yet again from GOOGLE groups -- Re: Help! Aragorn <stryder@telenet.be.invalid> - 2013-02-09 03:05 +0100
            Re: Necroposting yet again from GOOGLE groups -- Re: Help! Moe Trin <ibuprofin@painkiller.example.tld.invalid> - 2013-02-09 03:41 +0000
              Re: Necroposting yet again from GOOGLE groups -- Re: Help! Aragorn <stryder@telenet.be.invalid> - 2013-02-09 04:47 +0100
                Re: Necroposting yet again from GOOGLE groups -- Re: Help! Eric Pozharski <whynot@pozharski.name> - 2013-02-09 13:29 +0200
                PS1 Ivan Shmakov <oneingray@gmail.com> - 2013-02-09 19:11 +0000
                Re: PS1 Aragorn <stryder@telenet.be.invalid> - 2013-02-10 03:12 +0100
                Re: Necroposting yet again from GOOGLE groups -- Re: Help! Aragorn <stryder@telenet.be.invalid> - 2013-02-10 03:08 +0100
                Re: Necroposting yet again from GOOGLE groups -- Re: Help! Eric Pozharski <whynot@pozharski.name> - 2013-02-10 12:49 +0200

csiph-web