LINUX shell脚本攻略
LINUX shell脚本攻略
LINUX shell脚本攻略
echo Hello world ! 等价于 echo 'Hello world !' 但是不等价于echo "Hello world !"
(!放在双引号里边的时候需要转义\) www.2cto.com
(!放在双引号里边的时候需要转义\) www.2cto.com
简单的判断例子
1
#!/bin/bash
2
if [ $UID ne 0 ];then
3
echo Non root user.Please run as root.
4
else
5
echo "Root user"
6
fi
....
休息一会继续
www.2cto.com
继续
1
#!/bin/bash
2
start=$(data +%s)
3
commands;
4
statements;
5
end=$(data +%s)
6
differenc=$((end - start))
7
echo Time taken to execute commands is $difference seconds.
评论暂时关闭