tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Fun with shell

Annoy CSH behavior - deleting words in the command line ▻

About PS1, PS2, PS3 ...

In article <3778AE45.924EAC49@jerez.micro.lucent.com>,
Francisco Caliz  <fcc@jerez.micro.lucent.com> wrote:
>  I suppose PS2, PS3, etc... are alternatives for PS1 (that I know is
>the prompt text), but.. Anybody knows about the utility of these ?.

PS2 is used by the Bourne shell when it needs to read further lines to
complete a command.  Here is an example.

    $ for i in *
    > do
    > echo $i
    > done
    bar
    foo
    qux
    $

Initially, the shell prompts with PS1, `$ '. Because the first `for ...'
line is not a complete command, the shell keeps prompting with PS2, `> '
till it has something it can process.

PS3 and PS4 appear to be bash inventions: see the man page.

Tim.
--
Tim Goodwin   | "You don't need to do drugs in order to
University of | think that the government's policies are
Leicester, UK | stupid and dangerous." -- David Bancroft

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: About PS1, PS2, PS3 ...
Date: 29 Jun 1999 13:49:54 +0100
Organization: University of Leicester, UK
Message-ID: <7lafdi$emu$1@ltpcg.star.le.ac.uk>
References: <3778AE45.924EAC49@jerez.micro.lucent.com>

△ comp.unix.shell △

◅ Fun with shell

Annoy CSH behavior - deleting words in the command line ▻