Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!ucbvax!cbosgd!osu-cis!tut!lvc From: lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) Newsgroups: comp.unix.wizards Subject: Re: To . or not to . Message-ID: <970@tut.cis.ohio-state.edu> Date: Tue, 3-Nov-87 19:27:25 EST Article-I.D.: tut.970 Posted: Tue Nov 3 19:27:25 1987 Date-Received: Sat, 7-Nov-87 09:49:10 EST References: <648@tut.cis.ohio-state.edu> <722@wacsvax.OZ> Organization: Ohio State Computer & Info Science Lines: 49 Summary: the problem is the shell Frank O'Connor writes: > Please flame me if I am wrong but why wouldn't : > for p in $x/*/ > do > stuff > done > be sufficient. I don't believe the . is necessary. However, don't > take this an argument for doing away with . and ..! > > Frank O'Connor Actually the problem seems to be in the shell and not the os. In the Bourne shell on my SVR2 AT&T 3B5 */ expands to literall */ However, in the Korn shell on the same machine */ expands to f1/ f2/ ... fn/ Where f1 f2 ... fn are the names of *files and directories* in . Using csh under BSD */ expands to only directory names (at least on the Pyramid machine I'm writing this on). I wrote this short C program: #include #include main(argc, argv) int argc; char *argv[]; { register int i; struct stat stbuf; for (i = 1; i < argc; i++) if (stat(argv[i], &stbuf) == -1) printf("cannot stat '%s'\n", argv[i]); } Under BOTH BSD and SVR2 I ran it with arguments of filename/ or directoryname/ the stat succeeded. So it seems the os doesn't give a toot if there is an extra slash or not. Same result if you use open instead of stat (of course). Now whether or not the shell should expand */ to include only directories I don't know. It might would be useful. I can mention this to Dave Korn as a suggestion for ksh if you want. Larry Cipriani tut!lvc