[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interactive $PWD in prompt using /bin/sh ?



On Mon, Aug 23, 2004 at 04:33:54PM +0100, Matthew Law wrote:
> I'm using the bourne shell as default for my user account on OpenBSD 3.5 
> and I'd like the prompt to track the current $PWD.

I recommend to use /bin/ksh and set PS1 to something like

PS1="[${LOGNAME}_(_at_)_$(hostname -1):\${PWD}]$ "

or something like

PS1="[${LOGNAME}_(_at_)_$(hostname -1):\$(basename \${PWD})]$ "

for a shorter prompt.

With ksh, you can use parameter, command and arithmetic substitutions
in PS1. For more info, see ksh(1).

Ciao,
	Kili



Visit your host, monkey.org