Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Jan 2000 00:27:28 +0200
From:      Giorgos Keramidas <charon@hades.hell.gr>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Displaying `pwd` in sh(1) prompt?
Message-ID:  <20000122002728.B1387@hades.hell.gr>

next in thread | raw e-mail | index | archive | help

I'm using bash when I'm logged in, but I really find it's memory
consumption a bit too much.  I changed to /bin/sh for a while, but I
could not find any reasonable way of making my prompt something like:

	hostname!user:/current/path$ ...

It seems that if I put in my .shrc the commands:

	PS1="`hostname`!$LOGNAME:`pwd`\$ "

the prompt is fine, but when I change directories, the prompt stays
unchanged, and the new `current' directory is not there.  This is
perfectly normal, since sh(1) expands `pwd` once when setting PS1.

Is my only option a shell function like?

	cd () { chdir "$@" ; export PS1='blah blah'; }

I tried looking in sh(1) manpage for anything like an escape sequence
to put in the value of PS1, but I couldn't find anything helpful...

-- 
Giorgos Keramidas, < keramida @ ceid . upatras . gr >
"Don't let your schooling interfere with your education." [Mark Twain]


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000122002728.B1387>