Help - specific foreach (non-csh) script?
ai...@lvld.hp.com (Jim Aites) writes:
:Here's a sample of the requested syntax...
:$ foreach i ( *.lha ) "lha v $i >> tempx"
:What it *should* do (in this case) is to find all files in the current dir
:which have an .lha suffix. It should then lha (uncompress) in view mode
:those files, and concatinate the results into the output file.
:So, the first var is just a var. The second (parenthesized) var is really
:an lsf with pattern matching. The third "quoted field" var is the actual
:command implemented on each matching file.
:The csh version of this command could *almost* work, save for the
:delimiters around the passed variables. Heck, except for those delimiters
:I could write this myself! <wry grin>
:FYI - This is the command syntax I'm using on my Amiga, and I'd REALLY like
:to have a "form and function" match on my HPUX box. Can we get there from
:Thanks for any help. Awk, ksh, csh, or 'sh' solutions welcomed. I know
:I shouldn't be picky, but if you want to answer in Perl...please DON'T
:bother - I don't have it on my system.
You'd rather have csh on your system than perl?? Go figger.
Anyway, the only "correct" version is going to have to quote stuff,
for $file in *.lha; do
lha v "$i" >> tempx
Shells suck, eh? :-)
Tom Christiansen Perl Consultant, Gamer, Hiker tchr...@mox.perl.com
"AT&T -- anything better is illegal."
-- Keith Lofstrom, comp.unix.bsd, "AT&T sues BSDI" thread