Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!brunix!doorknob!jak From: jak@cs.brown.edu (Jak Kirman) Newsgroups: comp.unix.shell Subject: Csh: first character of an arg is '-': Solution Message-ID: Date: 7 Oct 90 04:18:15 GMT Sender: news@brunix.UUCP Reply-To: jak@cs.brown.edu Distribution: comp Organization: Department of Computer Science, Brown University Lines: 24 Before I get flooded with more replies, let me post the answer that barnett@crdgw1.ge.com, raymond@math.berkeley.edu and christos@theory.tn.cornell.edu all basically gave me: foreach i ($*) if ( $i =~ -* ) then # is an arg else # is not endif end Apart from the typo ~= instead of =~ , my problem was that I was quoting the right hand side, thinking that I did not want filename expansion, though as Raymond pointed out, I *do* want filename expansion, but expansion in the context of the left hand side, not of the current directory. It seems like strange magic to me, but it works... So thank-you for the replies. By the way, no-one yet has answered my second question: can you extract a character from a word? (Again, no forking allowed). Jak jak@cs.brown.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Contrepet du jour: Quand les Nippons arrivent, la Chine se souleve.