home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / shell / 5126 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.2 KB

  1. Path: sparky!uunet!nntp1.radiomail.net!fernwood!autodesk!dansmith
  2. From: dansmith@Autodesk.COM (Daniel Smith)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: foreach in csh alias (possible?)
  5. Message-ID: <18197@autodesk.COM>
  6. Date: 21 Dec 92 19:02:52 GMT
  7. References: <BzH1qo.2yt@news.iastate.edu>
  8. Organization: Autodesk Inc., Sausalito CA, USA
  9. Lines: 34
  10.  
  11. In <BzH1qo.2yt@news.iastate.edu> john@iastate.edu (John Hascall) writes:
  12.  
  13. > Well, I Read The Fine FAQ, but no mention of this, and I dinked with
  14. > it for the better part of an evening, but no luck.  So, is something like
  15. > this:
  16.  
  17. >      alias doit 'foreach xx (`list-o-xxs`) \\
  18. >           setenv $xx /foo/$xx \\
  19. >         end'
  20.  
  21. > possible?
  22.  
  23.     Yes, it's possible.  This is where simple aliases break down and
  24. sourcing aliases take over :-)
  25.  
  26. alias   mset 'set xx=(\!*); source ~/bin/multiset_script'
  27.  
  28.     and ~/bin/multiset_script is:
  29.  
  30. #!/bin/echo sorry,try:source
  31. foreach i ($xx)
  32.     setenv $i /foo/$i
  33. end
  34.  
  35.     When you find yourself writing multi-line aliases, stop :-)  They take
  36. longer to debug than bits of sourceable csh...
  37.  
  38.                     Daniel
  39.  
  40. -- 
  41.      Daniel Smith, Autodesk, Sausalito, California, (415) 332-2344 x 2580
  42.           Disclaimer: written by a highly caffeinated mammal
  43.         dansmith@autodesk.com            dansmith@well.sf.ca.us
  44.  
  45.