dansmith@well.UUCP (Dan Smith) (03/23/89)
Gandalf at Stanford is right; this keeps coming up over and over and over... I'll post mine, hopefully this or some variation will end up in frequently answered questions...this should be almost as familiar to .cshrc tweakers as the meaning of ":-)"! In article <341@hsi86.hsi.UUCP> derek@hsi86.UUCP (Derek Lee-Wo) writes: >This works only in BSD. > alias cd 'cd \!*;set prompt="[`/bin/pwd`] "' ...argh, don't run pwd unless you need to... ok, here's mine...fillstr needs to start out as a null, and comes into play when pushing and popping directories. I only like to show the parent and the current directory - the alternative is to (sometimes) have a prompt marching all over the screen :-) Push and pop will (p and pp) update the prompt so that you know how many levels deep you are. I tossed in some extras at the end that are good for times when you search for a file and want to copy it back to where you started. Hope this helps some people who may have otherwise lost some sleep over this monumental problem :-) # fillstr is a var used in prompt, contains "(level)" when dirs are pushed set fillstr="" set end=">>" # aliases...some of these go back a few years.. # directory manipulations alias prompt_set 'set ss=$cwd:h;set prompt="\! $ss:t/$cwd:t$fillstr $end "' alias dir_num 'set fillstr; set dnum=`dirs`; shift dnum; if ($#dnum >= 1) set fillstr=" ($#dnum)"' alias b 'set back=$old; cd $back; unset back; pwd' alias cd 'set old=$cwd; chdir \!*; prompt_set' alias cdl 'cd \!*; /bin/ls' alias p 'pushd \!*; dir_num; prompt_set' alias pp 'popd; dir_num; prompt_set' # push a directory, find the file you want, then copy it back to where you # came from... when you pop out, the copy will be there... alias cpb 'set bdir=`dirs`; /bin/cp -i \!* $bdir[2]' alias mvb 'set bdir=`dirs`; /bin/mv -i \!* $bdir[2]' alias lsb 'set bdir=`dirs`; echo "in $bdir[2]..."; /bin/ls -F\!* $bdir[2]' enjoy! dan -- Dan "Bucko" Smith, Lucasfilm, Marin County, CA well!dansmith unicom!daniel@pacbell.com daniel@island.uu.net ph: (415) 332 3278 (h), 258 2000 (w) disclaimer: Island's coffee was laced :-) My mind likes Cyberstuff, my eyes films, my hands guitar, my feet skiing...