Xref: utzoo comp.os.misc:338 comp.unix.wizards:5767 Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!sdcsvax!ucsdhub!esosun!seismo!uunet!nuchat!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.os.misc,comp.unix.wizards Subject: Re: Command interfaces Message-ID: <1255@sugar.UUCP> Date: 14 Dec 87 12:27:09 GMT References: <1257@boulder.Colorado.EDU> <6840002@hpcllmv.HP.COM> <9555@mimsy.UUCP> <5565@oberon.USC.EDU> Organization: Sugar Land UNIX - Houston, TX Lines: 32 In article <5565@oberon.USC.EDU>, blarson@skat.usc.edu (Bob Larson) writes: > For example, how would you do the equivelent of this in unix: > > cmpf *>old>@@.(c,h) == -report ==.+cmpf -file > > (Explanation: compare all files in the old sub-directory ending in .c or > .h with the file of the same name in the current directory, and put > the output in the file of the same name with .cmpf appended. Non-files > (directories and segment directories) ending in .c or .h are ignored. > [I do prefer the output of diff -c to that of cmpf, but that isn't > what I'm talking about here.] for i in old/*.[hc]; do diff -c $i `basename $i` > `basename $i`.diff; done Explanation: compare all files in the old subdirectory anding in .c or .h with the file of the same name in the current directory, and put the output in the file of the same name with .diff appended. This doesn't filter out directories because I wouldn't bother... but if you want: for i in old/*.[hc]; do if [ ! -d $i ]; then diff -c $i `basename $i` > `basename $i`.diff; fi; done If you want to do it recursively on all subdirectories of 'old': find old -name '*.[hc]' -type f -exec diff -c '{}' '`basename {} `'... These examples, by the way, both use the Primos meaning of wildcards. I presume that's what you want. i.e.: using the 'for i in pat' structure you can perform Primos style wildcarding on UNIX, but not vice-versa. What sort of control structures does Primos support? -- -- Peter da Silva `-_-' ...!hoptoad!academ!uhnix1!sugar!peter -- Disclaimer: These U aren't mere opinions... these are *values*.