Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.unix.questions Subject: Re: `pwd` in Shell prompt Message-ID: <7603@brl-smoke.ARPA> Date: 1 Apr 88 14:14:33 GMT References: <12747@brl-adm.ARPA> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <12747@brl-adm.ARPA> H235-017%IRLEARN.BITNET@cunyvm.cuny.edu (Mark Humphrys) writes: >I want to get the current directory to be automatically included in the Shell >prompt. Not again! This was beaten to death a few months ago. The answer is, a "vanilla" Bourne shell cannot update the PS1 string before every prompt (but the Korn shell can). A Bourne shell that does not support shell functions (e.g. the one shipped with Berkeley UNIX) cannot update the PS1 (prompt) string as a side-effect of executing a command to change directories, but shells with shell functions can. The vanilla SVR2 Bourne shell does not permit shell functions to have the same names as builtins, so such a command would have to be called something other than "cd" (e.g. "ch"). The BRL Bourne shell, like the 8th Edition UNIX shell that inspired some of its features, permits builtins to be displaced by shell functions, so for example my "cd" either updates the PS1 string on simple terminals or updates the window banner on fancy terminals (e.g. AT&T 630 or Sun). By the way, most people simply type "pwd" when they need to know what their current working directory is.