Shell wildcard expansion

Suleyman Kondakci suley at xantos.uio.no
Tue Jun 25 22:22:40 AEST 1991


Here is a simple csh-script, which renames its *.c args to *.o files:

#! /bin/csh
if ($#argv) then
	foreach from ($*)
		set renew = `echo $from:r`
		echo moving $from to $renew.o
		mv $from $renew.o
	end
exit 0
endif
# Didn't exit safely
cat <<EOF
`clear`

Syntax: $0 from_1.c from_2.c  to_1.o to_2.o ...
EOF



More information about the Comp.unix.shell mailing list