Foreach

Foreach.lha (MorphOS and AmigaOS3/4!) Readme
Usage: Foreach FILE/S,LINE/S,Strings/M/A,DO=Command/K/A,ALL=ALLFILES/S,LF=AddLF/S,V=VERBOSE/S,FREESTACK/S,FA=FailAt/K/N

Execute "command" for every word in "strings".
A "%s" in "command" will be replaced with the current word in "strings".
If a command returned an error, the execution gets aborted!

If you specify FILE on the commandline every word in "Strings" is treated as a file incl. pattern matching! Non existing files are skipped. f.e. Foreach FILE "ram:#?" "sys:#?" DO "echo %s"

If you specify LINE, every line of a file specified in "Strings", will handed over to the command.
Multiple files and pattern matching are supported.

I use it in combination with my ecx-script to compile multiple sources with one command.
For example: Foreach modules/winMain_mcc.e modules/app_mcc.e ecxHelper.e DO "s:ecx %s DEBUG"

Its written in AmigaE with the ecx compiler by Leif Salomonsson! I also included a 68k and AmigaOS4 version.

History: see the readme for the history!

Have fun with it, and if you have some ideas/bug reports send it to Foreach(at)igracki(dot)de.

5KB, v1.9, 26.02.17, for MorphOS and AmigaOS3/4!