SYNTAX

    foreach [options] <directory_name> [<script_file_name>] [<script_args>]


OPTIONS

-h (--help) bool

Display help.

-k (--keep-going) bool

Keep processing the script even if a previous command has returned an error. Without this option set, an error would cause script processing to abort (and the source command to exit with the error code) unless either &&, || or &| was used to handle the error.


ARGUMENTS

<directory_name>

The name of the directory to iterate through. [filename]

[<script_file_name>]

The name of the script file to be run. If not specified (or specified with zero length, i.e. ''), the script will be read from stdin. [filename]

[<script_args>]

The arguments to pass to the script. Any further arguments or options will be coalesced into this one. [string]


DESCRIPTION

Execute a script for each file in a specified directory.

This command is similar to source, but executes the specified script once for every entry (file or directory) that is found in the specified directory. The first argument passed to the script is the full path name of the entry. If any script_args were specified, these are passed to the script as the second and third arguments, etc.

Note, as with source, this command executes in the context of the fshell instance that executed it. Any changes to environment variables will be written to the fshell environment when it completes.


SEE ALSO

source


COPYRIGHT

Copyright (c) 2006-2010 Accenture. All rights reserved.