- 博客(2)
- 收藏
- 关注
原创 shell: 判断一条命令是否成功运行
shell: 判断一条命令是否成功运行 每一条基本命令执行后都有一个返回码,该返回码是用?表示,如果想取出返回码则用$?得到返回码内容,执行成功的返回码是0,非0则是执行不成功,例如: Command 1 if [ $? -ne 0 ];then echo "The program failed to run." else echo "The program runs succes...
2019-12-12 14:25:34
702
原创 shell: 判断变量中是否有某个字符
shell: 判断变量中是否有某个字符 如判断str变量中是否含有this: str="this is a string" if [[ $str =~ "this" ]];then echo "$str contains this." else echo "$str doesn't contain this." fi ...
2019-12-12 14:17:00
1228
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人