- #!
- #
- ;
- &&
- ||
- &
- $var (${var})
- $(command) (`command`)
- $(( expression ))
- $?
- {n..n2}
- [ condition ]
- 模式匹配
sh文件与function中
- $#
- $@
- $*
- $0
- $1 $2 $3 ...
----
function fun_name(){
coding
}
----
if [ condition ]; then
coding
(
elif [ condition ]; then
coding2
)(...)
(
else
coding3
)
fi
----
case $var in
case1)
coding
;;
case2)
coding
;;
(
*)
coding
)
esac
----
while [ condition ]
do
coding
done
----
until [ conditon ]
do
coding
done
----
for var in con1 con2 con3 ...
do
coding
done
----
for (( init; condition; step ))
do
coding
done