Shell脚本
雜貨鋪老闆
这个作者很懒,什么都没留下…
展开
-
Linux frequently used commands
原文地址:http://matrix207.github.io/2013/01/05/linux-common-command/ shell terminal!! the previous command (Actually the latest command list with commandhistory) !-1 is equal to !!!-2 is s转载 2013-08-27 17:49:18 · 691 阅读 · 0 评论 -
linux shell 中判断字符串为空的正确方法
原文地址:http://www.cnblogs.com/cute/archive/2011/08/26/2154137.htmlhelp命令可以查看帮助help test 正确做法: #!/bin/sh STRING= if [ -z "$STRING" ]; then echo "STRING is empty" fi if转载 2014-12-24 16:10:07 · 981 阅读 · 0 评论 -
linux if多条件判断
原文地址:http://blog.sina.com.cn/s/blog_7921902d01012nla.htmlif 条件判断中有多个条件#!/bin/bashscore=$1if [ $score = 5 ]||[ $score = 3 ];then echo rightelse echo wrongfi---------转载 2014-12-24 16:14:53 · 4439 阅读 · 0 评论 -
shell脚本执行返回的状态码
Linux下一条命令或一个进程执行完成会返回一个一个状态码。0 === 成功执行非0 === 执行过程中出现异常或非正常退出在Shell脚本中 最后执行的一条命令将决定整个shell脚本的状态. 此外 shell的内部命令exit也可以随时终止shell脚本的执行,返回Shell脚本的状态码当shell脚本执行结束前 的最后一个命令是不带参数的exit ,那么 shell转载 2016-10-17 21:48:50 · 9082 阅读 · 0 评论 -
shell用变量的值作为新的变量名
tips:使用eval例如:[plain] view plain copy #!/bin/bash name=yushuang var=name # 要获取到yushuang res=`eval echo '$'"$var"` echo $res 说明:第一步: "$var" -->name第二步: echo '$'"$转载 2016-12-14 13:56:39 · 3383 阅读 · 0 评论