foreach

NAME

foreach - execute commands for each item in a list

SYNOPSIS

foreach name (wordlist)
...
end

DESCRIPTION

This command is a C-shell built-in command.

The foreach(1) command successively sets the variable name to each member of wordlist and executes the sequence of commands between this command and the matching end. (Both foreach and end must appear alone on separate lines.) Use the built-in command continue to continue the loop prematurely; use the built-in command break to terminate it prematurely. When this command is read from the terminal, the loop is read once, prompting with 'foreach? ' (or prompt2) before any statements in the loop are executed. You can rub out any mistake you make typing in a loop at the terminal.