一,shell常见语句总结:
a,if ,for,while 等语句和后面的'[‘要保持一个空格。
b,句子结尾用不用分号都可以,建议使用。
c,while后的'[‘ 是双个的包含变量的话
二,linux操作实例
#!/bin/bash
hello(){
if [ -f 'test.sh' ]; then
echo " the file is exist."
else
echo "the file is not exits."
fi
}
app1(){
a=1
b=2
if [ -n $a ];then
echo $a '-n a is true.'
else
echo '-n a is false.'
fi
if [ -n $c ];then
echo $c '-n c is true.'
else
echo '-n c is false.'
fi
}
app3(){
echo "function name @:"$0
echo "all param @:"$@
echo "all params * :"$*
echo "total params count:"$#
echo "first param" $1
echo "second param" $2
return 3
}
app4(){
a=5;
for i in a b c d ; do
echo "i="$i;
done;
for((i=1;i
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net