home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!nntp1.radiomail.net!fernwood!autodesk!dansmith
- From: dansmith@Autodesk.COM (Daniel Smith)
- Newsgroups: comp.unix.shell
- Subject: Re: foreach in csh alias (possible?)
- Message-ID: <18197@autodesk.COM>
- Date: 21 Dec 92 19:02:52 GMT
- References: <BzH1qo.2yt@news.iastate.edu>
- Organization: Autodesk Inc., Sausalito CA, USA
- Lines: 34
-
- In <BzH1qo.2yt@news.iastate.edu> john@iastate.edu (John Hascall) writes:
-
- > Well, I Read The Fine FAQ, but no mention of this, and I dinked with
- > it for the better part of an evening, but no luck. So, is something like
- > this:
-
- > alias doit 'foreach xx (`list-o-xxs`) \\
- > setenv $xx /foo/$xx \\
- > end'
-
- > possible?
-
- Yes, it's possible. This is where simple aliases break down and
- sourcing aliases take over :-)
-
- alias mset 'set xx=(\!*); source ~/bin/multiset_script'
-
- and ~/bin/multiset_script is:
-
- #!/bin/echo sorry,try:source
- foreach i ($xx)
- setenv $i /foo/$i
- end
-
- When you find yourself writing multi-line aliases, stop :-) They take
- longer to debug than bits of sourceable csh...
-
- Daniel
-
- --
- Daniel Smith, Autodesk, Sausalito, California, (415) 332-2344 x 2580
- Disclaimer: written by a highly caffeinated mammal
- dansmith@autodesk.com dansmith@well.sf.ca.us
-
-