prompt question

Chet Ramey chet at thor.INS.CWRU.Edu
Thu Jan 24 03:43:24 AEST 1991


In article <1991Jan23.083259.16296 at daimi.aau.dk> pilgrim at daimi.aau.dk (Jakob G}rdsted) writes:
>I want a little script to be executed, every time
>I press return (I want the prompt to change).

Bash will do this for you.  To have `prog' executed before each primary
prompt, do the following:
PROMPT_COMMAND=prog

Bash also expands a number of control strings in the prompt before it
is printed; if you want the prompt to change to include one of the
following it's not necessary to run a script

        \t      the time
        \d      the date
        \n      CRLF
        \s      the name of the shell
        \w      the current working directory
        \W      the last element of PWD
        \u      your username
        \h      the hostname
        \#      the command number of this command
        \!      the history number of this command
        \$      a $ or a # if you are root
        \<octal> character code in octal
        \\      a backslash

Chet
-- 
Chet Ramey				``There's just no surf in
Network Services Group			  Cleveland, U.S.A. ...''
Case Western Reserve University
chet at ins.CWRU.Edu		My opinions are just those, and mine alone.



More information about the Comp.unix.misc mailing list