Saturday, April 17, 2010

[Linux]cheeting sheet of sh, csh, bash

sh, csh, bash 比较

Statement sh tcsh bash
if-then-else
if [ expression ] 
then
    ...
else
    ...
fi
if (expression) then
    ...
else
    ...
endif
注:then必须和if同一行
if [ expression ]
then
    ...
else 
    ...
fi 
for-loop
for var in (list)
do
    ....
done
foreach var (list)
    ...
end
for var in [list]
do
    ...
done 
Loop in Bash: http://www.cyberciti.biz/faq/bash-for-loop/

Sh: http://www.freeos.com/guides/lsst/
Bash: http://tldp.org/LDP/abs/html/