Path: utzoo!attcan!uunet!ginosko!ctrsol!sdsu!bionet!agate!ucbvax!NUSVM.BITNET!GBOPOLY1 From: GBOPOLY1@NUSVM.BITNET (fclim) Newsgroups: comp.sys.apollo Subject: Re: Aliases for Aegis Commands Message-ID: <8907290755.AA27040@umix.cc.umich.edu> Date: 29 Jul 89 07:57:48 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 72 X-Unparsable-Date: Sat, 29 Jul 89 15:51:32 SST Here's another alias for csh. It implements the Korn shell feature of cd-ing to the previous working directory : % pwd foo % cd bar ; pwd bar % cd - ; pwd foo % cd - ; pwd bar I'm not sure if the 4.3BSD csh has this feature, but it's certainly not available on 4.2BSD (SR9.7). Anyway, you need to add this to your ~/.cshrc set prev = ~ as well as the alias alias cd set tmp = $cwd; if (!* == -) cd $prev; if (!* != -) cd !*; set prev = $tmp; unset tmp Please note that I have split the alias into several lines to show the structure. But you have to put them on a single line; it won't work if the alias is over several lines. It's a kludge which I don't know how to get round (just look at the ulgy double comparisons of !* with -). alias cd 'set tmp = $cwd; if (!* == -) ... $tmp; unset tmp' BTW, a good book to invest in is The Unix C Shell Field Guide Gail and Paul Anderson Prentice-Hall ISBN 0-13-937468-X 025 Look up the gt and gb aliases in section 6.3 on page 125-126. Here's a interesting feature that you'll not find using /com/sh. We all know how useful ` (back-quote) is; especially for sys_admin personnel. $ wd `node_data will put you into the /sys/node_data directory of the node you are working on. However, if you need to go into the node_data dir of a different node, you have to give the full pathname starting from the network root : $ wd //london/sys/node_data This is what I did to maintain my reputation for laziness. Firstly, I did this (only once) % mkdir ~/nd ; cd ~/nd % foreach x (//*) ? ln -s $x/sys/node_data $x:t ? end Thus, I now have ~/nd/london as a link to //london/sys/node_data. Next, I put in my ~/.cshrc set cdpath = (~/nd) (See the Andersons' book on the concept of cdpath which is also available on Bourne and Korn Shells.) Now, I am set up for life. No matter where I am, if I want to get to //london/sys/node_data, I just type in % cd london This feature also works with pushd : % pushd london will get me to london while keeping a record of where I have been. fclim --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu computer centre singapore polytechnic dover road singapore 0513.