AminetAminet
Search:
84721 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/cli/Foreach_igracki.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:Execute cmd for every argument/file/line
Author:Thomas at Igracki.de (Thomas Igracki)
Uploader:Thomas Igracki de (Thomas Igracki)
Type:util/cli
Version:1.9
Architecture:ppc-morphos; ppc-amigaos; m68k-amigaos
Distribution:Aminet
Kurz:Befehl für alle Argument/Files ausführen
Date:2017-02-26
Download:http://aminet.net/util/cli/Foreach_igracki.lha - View contents
Readme:http://aminet.net/util/cli/Foreach_igracki.readme
Downloads:1399

Usage: Foreach
FILE/S,LINE/S,Strings/M/A,DO=Command/K/A,ALL=ALLFILES/S,LF=AddLF/S,V=VERBOSE/S,F
REESTACK/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"

I use it in combination with my ecx-script to compile multiple sources with one
command.

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

History:
05-Sep-16: v1.9
  fix: a small fix with OR handling

24-Mai-16: v1.8
  fix: Foreach didn't hold the Result2 value anymore due to recently changes
  new: ENV:Foreach_LastFile holds the last processed filename
	   usefull f.e. if you want to get the filename which aborts the execution

14-Mai-16: v1.7
  new: added a FailAt/K/N option, like Shell's FailAt commmand, to change 
	   failure limit of executed commands (0=Ok, 5=Warn, 10=Error, 20=Fail)
	   To NOT abort execution if only one file throws an error
	   Default is 10

13-Dez-15:
  fix: Starting Foreach with no arguments printed many bogus chars

30-Mar-15: v1.6
  new: added LINE/S, to do a command for every line in a file
	   The files are specified via the "<strings>" options.
	   Multiple files and pattern matching are supported and the ALL option
  fix: Sometimes the ALL/S switch to return recursively all files didn't worked
correct 

23-Dec-14: v1.5
  fix: option VERBOSE/S didn't prints the argument in front of the output
sometimes,
       f.e. if c:Type was used
  new: added FREESTACK/S option to show the free stack, only for debugging
purpose
  new: you can now use upto 8 "%s" in the DO option

11-Mar-14: v1.4
  chg: Raised stack to 32KB, cause I have some weird hits sometimes, lets see if
it helps...

05-Aug-13: v1.3
  chg: The VERBOSE option now prints the current argument in front of the output
  new: added LF=AddLF/S switch, append a LF after the commands output.
	   Usefull if the command doesn't outputs an LF at the end

01-Aug-13: v1.2
  new: added ALL=ALLFILES/S switch, to recursively scan directories, if FILE is
set
  fix: if FILE is set, then don't execute the command for directories

09-Jul-13: v1.1
  new: added a FILE/S switch, "strings" are then treated as files, incl. pattern
matching!

01-Jul-13: v1.0 first release 


Contents of util/cli/Foreach_igracki.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[generic]                 2709    5416  50.0% -lh5- c1f1 Sep  5 16:47 Foreach/Foreach
[generic]                 1392    2861  48.7% -lh5- 8a21 Feb 26 15:50 Foreach/Foreach.readme
[generic]                 1850    3008  61.5% -lh5- c2be Jul 16  2013 Foreach/Foreach_68k
[generic]                 2321    4668  49.7% -lh5- 1f5a Jul 16  2013 Foreach/Foreach_OS4
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         4 files    8272   15953  51.9%            Feb 26 18:13

Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>