Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!danews!lvc From: lvc@danews.UUCP Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: Prompt changing on the fly - Oops Message-ID: <376@danews.ATT.COM> Date: Sun, 18-Jan-87 15:09:47 EST Article-I.D.: danews.376 Posted: Sun Jan 18 15:09:47 1987 Date-Received: Mon, 19-Jan-87 02:04:17 EST References: <432@ethz.UUCP> <374@danews.ATT.COM> Reply-To: lvc@danews.UUCP (Larry Cipriani, x4999, 2B220, 45230) Distribution: world Organization: AT&T Bell Labs, Columbus OH Lines: 34 Keywords: prompt Xref: watmath comp.unix.questions:682 comp.unix.wizards:616 >What shell are you using? It is possible in the Korn shell. >Impossible in the Bourne shell. I don't know about the C-shell. >My prompt includes a clock that is updated at every return. Later that same day: Oops, it is possible in the Bourne shell. What you can do is define a function (not well known in the Bourne shell) to do your cd's and set PS1. chdir() { case ${#} in 1) cd $1 && PS1="`pwd` " ;; *) echo "usage: chdir directory" >&2 return 1 ;; esac } Now just use chdir instead of cd. In the Korn Shell, you can do something like: PS1='${PWD} ' This works because PS1 is *evaluated* every time it is printed. You can use cd and PS1 is updated automatically. -- Larry Cipriani Cornet 353-4999 AT&T (614) 860-4999 {ihnp4|cbosgd}!cbsck!lvc AT&T Network Systems rm 2B-220