|
- Shell variables store strings. Bourne shell syntax here:
$ files="one.html two.html three.html"
$ emacs $files
$ cvs add $files
- Use command substitution to store command output in a variable:
$ files=`find . -name '*.html' -mtime -1 -print`
- Loops (for in Bourne-type shells, foreach
in C-type shells) repeat series of commands, storing an argument
in a variable before each pass:
$ for file in one.html two.html three.html
> do cp -i $file $file.bak
> done
- Combine loops with wildcards, variables and/or command substitution:
$ for file in *.html
or...
$ for file in `find . -name '*.html' -mtime -1 -print`
or...
$ for file in $files
|