Pages

2008-04-30

Bourne shell idioms

"Here are some portable Bourne shell idioms that I find useful to remember for scripting. The Bourne shell does much more than most users realize, and the ksh and bash extensions are rarely essential. (From the command-line, bash and ksh are vastly more useful.)"

http://billharlan.com/pub/papers/Bourne_shell_idioms.html

For example

"
Loop over the elements of a PATH by tokenizing with the character ':'.
IFS=':' ; for dir in $PATH ; do echo $dir ; done
"

No comments: