Xref: utzoo comp.unix.misc:857 comp.windows.misc:1752 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!rex!ukma!usenet.ins.cwru.edu!thor!chet From: chet@thor.INS.CWRU.Edu (Chet Ramey) Newsgroups: comp.unix.misc,comp.windows.misc Subject: Re: prompt question Message-ID: <1991Jan23.164324.16473@usenet.ins.cwru.edu> Date: 23 Jan 91 16:43:24 GMT References: <1991Jan23.083259.16296@daimi.aau.dk> Sender: news@usenet.ins.cwru.edu Reply-To: chet@po.CWRU.Edu Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA) Lines: 33 Nntp-Posting-Host: thor.ins.cwru.edu In article <1991Jan23.083259.16296@daimi.aau.dk> pilgrim@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 \ 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@ins.CWRU.Edu My opinions are just those, and mine alone.