Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!clyde!cuae2!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: net.unix Subject: Re: Korn Shell Question Message-ID: <1283@ttrdc.UUCP> Date: Thu, 30-Oct-86 13:41:19 EST Article-I.D.: ttrdc.1283 Posted: Thu Oct 30 13:41:19 1986 Date-Received: Fri, 31-Oct-86 13:50:23 EST References: <22300001@ntvax> Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 47 In article <22300001@ntvax>, mike@ntvax.UUCP writes: > >I have a Korn Shell question that perhaps someone can answer. I like to >have as my system prompt my current path. When I use csh, I set up my >.cshrc file with these entries: > >set prompt = "! `pwd`}" -- this establishes my prompt as my command number > and current path when i first initiate the shell > >alias cd 'chdir \!:1; set prompt=\!\`pwd`}\' > this sets up my cd command to not only change > my working directory but to change the prompt. > >I would like to have something similar to this in ksh but I'm not sure how >to change PSx on the fly. Has someone done something similar to this?? > >Any help would be greatly appreciated. > > > > |######################################| > |# J. Michael Flanery #| > |# Computer Science Dept. #| > |# North Texas State University #| > |# UUCP: {ihnp4}!infoswx!ntvax!mike #| > |######################################| In ksh, define (say) chdir as a shell function, then alias cd to it. ksh aliases aren't recursive, so this works: case $0 in *ksh) PS1=!$PWD} chdir() { cd $1 # this shell function will return here if the cd fails PS1=!$PWD\} } alias cd=chdir esac -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, go for it! allegra,ulysses,vax135}!ttrdc!levy