Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.os.misc,comp.unix.wizards
Subject: Re: Command interfaces
Message-ID: <9679@mimsy.UUCP>
Date: Tue, 8-Dec-87 10:14:23 EST
Article-I.D.: mimsy.9679
Posted: Tue Dec  8 10:14:23 1987
Date-Received: Sun, 13-Dec-87 14:31:15 EST
References: <1257@boulder.Colorado.EDU> <6840002@hpcllmv.HP.COM> <9555@mimsy.UUCP> <5565@oberon.USC.EDU>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 39
Xref: mnetor comp.os.misc:339 comp.unix.wizards:5927

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.

`sh' is a programming language, and can be shown to be Turing
equivalent (proof by vigourous handwaving), so unless the Pr1me
CLI can also be shown to be Turing equivalent, the Unix shell
interface is more powerful.

	for i in old/*.[ch]; do		# all files in the old subdir..
		if [ -f $i ]; then	# ignore directories named .c or .h
			j=`echo $i | sed 's,.*,,'`
					# get name without leading dir
			diff $i $j > $j.cmpf
					# and compare, output in `.cmpf'
		fi
	done

(I never said it was more concise. :-) )

This sort of thing, like the `rename *.bar .baz' that others are
so proud of :-) , seems to be desired only rarely; in such cases,
shell `for' loops, or programs like one posted sometime last year[1],
do the trick quite easily.

-----
[1] Program name and author forgotten, but basically, it ran a
command iteratively, so that *.bar could be renamed to *.baz with
a syntax like `doit mv \*.bar =.baz'.  It may have been posted
more than a year ago.  At any rate, I did not save it.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris