Scripting: No foreach command

I am working on a script file, and am having trouble. In C shell I am used
to having a foreach command to look at a series of items.
In this case I want to look at each file, and if it fits a certain criteria
I will perform a series of commands on it. But looking through the
different help books, I can’t seem to find a similar command for the QNX sh.

Any help would be appreciated.

Thanks,

Ben

Ben,
This script is similar to ls. You can do more complicated things with
$file
with commands such as “if [ expression ] ; then”. Recently, I refreshed my
memory on bourne shell scripts with www.about.com and searched for bourne
shell loop.

Regards,

Bob Stelling
Software Remodeling, Inc

#/bin/sh

for file in $* ; do

echo $file

done

Ben Burns <bburns@nyab.com> wrote in message
news:9cv5b9$bo2$1@inn.qnx.com

I am working on a script file, and am having trouble. In C shell I am
used
to having a foreach command to look at a series of items.
In this case I want to look at each file, and if it fits a certain
criteria
I will perform a series of commands on it. But looking through the
different help books, I can’t seem to find a similar command for the QNX
sh.

Any help would be appreciated.

Thanks,

Ben

Ben Burns <bburns@nyab.com> wrote:

I am working on a script file, and am having trouble. In C shell I am used
to having a foreach command to look at a series of items.

for var in list
do
whatever
done

Is the equivalent structure under ksh.

-David


QNX Training Services
dagibbs@qnx.com