I always forget the foreach syntax. Here is a quick example that reads all the contents of a directory into an array, prints out the name of each file, runs a simple grep on it, and ends.
foreach i ( ` /bin/ls * ` )
foreach? echo $i
foreach?/bin/grep your_grep_string $i
foreach? end
Pingback: spiralbound.net » Using Sort to List Directories by Size
gr8 link, help a lot, thanks….
Pingback: spiralbound.net » Bash For loop Example
Thanks a lot, men!
How I can write loop without nubmers but with some strings like ‘a’, ‘b’, ‘c’?
Thanks for the info! Very simple. Helps a lot