lvc@danews.UUCP (01/18/87)
>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
chris@mimsy.UUCP (01/19/87)
In article <376@danews.ATT.COM> lvc@danews.ATT.COM (Larry Cipriani) writes: >>Impossible in the Bourne shell. I don't know about the C-shell. [also Larry] >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. Not all Bourne shells are bourne equal. (Sorry) *If* your Bourne shell has shell functions, yes; if not, you are also correct. How can you tell whether your Bourne shell has shell functions? Try Larry's example chdir(). If sh says syntax error: `(' unexpected it does not have shell functions. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu
gerolima@wdl1.UUCP (Mark Gerolimatos) (01/19/87)
In C-shell, try: set prompt = "`your favorite command`" "For almost a quarter of a century..." Mark Gerolimatos ARPA: gerolima@ford-wdl1.{arpa,com} "Let's take our neighbor for a ride! UUCP: {sun,fortune}!wdl1!gerolima Would you like to go for a ride!?" AT&T: (415) 852-4105 "Uuhhhh...no thanks." USPS: c/o Ford Aerospace "No what!?" "No, I wouldn't like to go." 3939 Fabian Way "Go Where!?" "Uuhh...for a ride..." Palo Alto CA 94303 "GOOD IDEA!!! LET'S GO FOR A RIDE!!!" Mail Stop X20