Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!topaz!ll-xn!mit-amt!mit-eddie!mit-trillian!rlk From: rlk@mit-trillian.MIT.EDU (Robert L Krawitz) Newsgroups: net.sources Subject: Re: a useful alias Message-ID: <1004@mit-trillian.MIT.EDU> Date: Wed, 13-Aug-86 21:09:34 EDT Article-I.D.: mit-tril.1004 Posted: Wed Aug 13 21:09:34 1986 Date-Received: Thu, 14-Aug-86 20:21:02 EDT References: <-745727@homer> Reply-To: rlk@trillian.UUCP (Robert L Krawitz) Organization: MIT Project Athena Lines: 31 The only problem with that alias is that it doesn't discriminate between directories and other files. A slight modification, with the help of a small C program, fixes that: alias ncd 'set d=`echo \!^* | sed "s/./\/&*/g"`; set d = `dirp $d`; cd $d || echo $d' /* dirp -- echo arguments that are directories */ #include #include #include struct stat stats; main(argc,argv) int argc; char **argv; { char *file; argc--; argv++; while (argc > 0) { file = *argv; stat(file, &stats); if (((stats.st_mode) & S_IFMT) == S_IFDIR) printf ("%s\n", file); argc--; argv++; } } -- Robert^Z