foreach Command
Syntax:
foreach item ( list-of-items )
shell commands
end
Example:
foreach item ( ‘ls *.c’ )
cp $item ~/.backup/$item
end
Special statements:
break causes control to exit the loop
continue causes control to transfer to the test at the top
Previous slide
Next slide
Back to first slide
View graphic version