adamm@encore.UUCP (Adam S. Moskowitz) (10/07/87)
Help! I need a way to have an alias take a variable number of arguments
from the command line and act on each of them individually. For example:
% xxx foo bar baz
to wind up aliasing to the equivalent of:
% foreach f (!*)
mv $f $f.old
end
Yes, I know I could just do this in a shell script, but this something I
invoke many, many times per day and I want it to be as fast as possible (i.e.
as few disk accesses as possbile). Also, I know that I could make an alias
that does what I want for one arg, then make the real alias that uses 'apply',
but this has two problems - apply is slow (at least, the case using apply with
one arg seems to be slower than the alias with one arg), and second, that I
will be passing this laias along to some friends that have a csh, but not
apply (i.e. they run on PC's under some UN*X variation/derivative).
So, oh great wizards and those who are enlightened, is there a way to do
what I want to do (via a foreach or something like that inside an alias)?
If so, please send specfic examples, as everything I have tried has failed
(obviously, or I wouldn't be posting this :-)).
--
Adam S. Moskowitz ...!{decvax,ihnp4,linus,necntc,talcott}!encore!adamm
"How long, Dear Savior, oh how long, will this damn 'cc' take?
Fly swift around ye idle bits and bring the promised a.out"