Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!swlabs!csd_v!bak From: bak@csd_v.UUCP (Bruce) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: PS1 and the bourne shell... Message-ID: <133@csd_v.UUCP> Date: Fri, 20-Nov-87 00:12:37 EST Article-I.D.: csd_v.133 Posted: Fri Nov 20 00:12:37 1987 Date-Received: Mon, 23-Nov-87 03:11:41 EST References: <279@caus-dp.UUCP> <1926@marque.mu.edu> Organization: Computer Systems Design -- Sandy Hook, Ct. Lines: 40 Keywords: Brain dead system... Summary: ...my version Xref: mnetor comp.unix.questions:5018 comp.unix.wizards:5540 In article <1926@marque.mu.edu>, nic@marque.mu.edu (Nic Bernstein) writes: > ^^^^^^ > >won't let us do things like the following... > > > > export ps1 > > cd() > > { > (function deleted) > > } > > > >The program bombs at the cd() statment and returns the statment: > >-sh: syntax error: `(' unexpected > > > I am not sure about Xenix, but Borne usually doesn't support > functions... The problem is not that the bourne shell doesn't support sys5 functions, it's that a function cannot replace a builtin. If you have ksh you can use an alias to do the job but in sh you must rename the command. Thus: $ ccd() > { > cd $* > PS1="`pwd`> " > } $ ccd /usr/bak /usr/bak> pwd /usr/bak /usr/bak> will do the job. However since the cd command is not disabled it is very easy for the prompt to be inaccurate, because of the tendency to use the 'cd' command instead of the 'ccd' command. So although I use a version of this in MSDOS and VMS systems, I don't use it in a UN*X system. -- Bruce Kern -- Computer Systems Design, 29 High Rock Rd., Sandy Hook, Ct. 06482 uunet!swlabs!csd_v!bak