Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!rice!uw-beaver!mit-eddie!wuarchive!uunet!motcid!dalessio From: dalessio@motcid.UUCP (Mario D'Alessio) Newsgroups: comp.unix.shell Subject: Re: ksh prompt Message-ID: <5935@feldspar23.UUCP> Date: 4 Mar 91 21:14:17 GMT References: <1772@brchh104.bnr.ca> Organization: Motorola Inc., Cellular Infrastructure Div., Arlington Heights, IL Lines: 36 herrage@brchh107.BNR.CA (Robert Herrage) writes: >I have the following defined in my .profile: > alias prompt="PS1=\"--> \`pwd\` <-- > hostname> \"" > >This sets my prompt to put my current directory on one line >and my prompt below it on the next line. I also want to have >an alias (or something) for "cd" so that when I use "cd" to >change directories, my prompt will update accordingly. The >problem is that when I alias "cd", ksh doesn't parse for any >imbedded aliases. Therefore, > alias cd='cd $*;prompt' > To change the prompt using the cd command, I use a ksh function and alias combination. Notice the backslash preceeding the cd in the function: function _cd { \cd $* export PS1="${PWD}-> " } alias cd=_cd ****************************************************************** * ************************************************************** * * * * * * * Mario D'Alessio Motorola, Inc. * * * * dalessio@motcid.UUCP Cellular Infrastructure Group * * * * * * * ************************************************************** * ******************************************************************