Path: utzoo!attcan!uunet!mcsun!ukc!acorn!ixi!mike From: mike@x.co.uk (Mike Moore) Newsgroups: comp.unix.questions Subject: Re: 'cd' in shell-script or .profile Message-ID: Date: 15 Jun 90 16:13:39 GMT References: <5672@aplcen.apl.jhu.edu> Reply-To: mike@x.co.uk (PUT YOUR NAME HERE) Distribution: comp.unix.questions Organization: IXI Limited, Cambridge, UK Lines: 34 In article <5672@aplcen.apl.jhu.edu> trweil@aplcen.apl.jhu.edu (Weil Timothy Robert) writes: >I'd like to be prompted after login as to which directory >I'd like to be working in - > >Tried a simple prompting via shell script; also tried >inserting same prompting in .profile (Ultrix running >Korn Shell)... > >results were similar - a 'pwd' would indicate that I'd >changed to the selected directory but UNIX kept me >logged into $HOME....any other tricks to try? > I don't know about korn shell, but Bourne shell works with: c=`echo "\c"`; [ "$c" = "" ] && { c="\c"; n=""; } || { c=""; n="-n"; } echo $n "Enter working directory: $c" read HOME export HOME cd $HOME if you put it into the .profile. any cd after this will take you to $HOME (i.e. your newly specified working directory) don't worry about the first line, it just works out if you need \c or -n to stop echo sending a newline to the terminal Mike -- -------------------------------------------------------------------------- Usual disclaimer..... etc | mike@x.co.uk True Intelligence is not knowing all the answers, | it's knowing the right questions. |