home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.centerline.com!noc.near.net!hri.com!spool.mu.edu!yale.edu!ira.uka.de!smurf.sub.org!flatlin!bad
- From: bad@flatlin.ka.sub.org (Christoph Badura)
- Newsgroups: comp.unix.shell
- Subject: Re: Is there a "foreach" loop control in ksh?
- Message-ID: <C17nHu.6MA@flatlin.ka.sub.org>
- Date: 21 Jan 93 15:39:29 GMT
- References: <1304@alsys1.aecom.yu.edu>
- Organization: Guru Systems/Funware Department
- Lines: 25
-
- In <1304@alsys1.aecom.yu.edu> manaster@yu1.yu.edu (Chaim Manaster) writes:
-
- >I want to do a series of comands on each file in the current
- >directory, with some sort of "foreach" construct that will loop
- >over every file in some list (something like in perl), or in some
- >cases every file in the current directory. How would one do this in
- >ksh?
-
- for variable in word...
- do
- ...
- done
-
- >In particular, I want to run compress on each file in the directory
- >that does not already end in a .Z (dito for uncompress in
- >reverse).
-
- compress `ls|egrep -v Z\$`
-
-
- --
- Christoph Badura --- bad@flatlin.ka.sub.org
-
- Personally, I don't care whether someone is cool enough to quote Doug
- Gwyn--I only care whether Doug Gwyn is cool enough to quote. -- Larry Wall
-