shell

来源:互联网 发布:idm for mac 破解 编辑:程序博客网 时间:2024/06/08 06:46

目前流行的shell有ash、bash、ksh、csh、zsh等。
一般的linux系统都将bash作为默认的shell。
shell下的运算符
数值比较:
-eq: 等于则为真。
-ne : 不等于则为真。
-gt : 大于则为真。
-ge : 大于等于则为真。
-lt : 小于则为真。
-le : 小于等于则为真。

字符串比较:
= : 等于则为真。
!= :不等于则为真。
-z : 字符串长度为0则为真。
-n : 字符串长度不为0则为真。

shell下的循环语句

if条件语句
if[ ]
then
xxxxxx;
else
xxxxxx;
fi

for 循环
for [ ]
do
xxxxxxx;
done

while循环
while
xxxxxxx;
do
xxxxxxx;
done

0 0