linux shell 判断命令执行状态
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
在shell中 变量$?保存的是上一条命令的执行结果,0 为成功,1是失败。所以在shell中如果后一个命令集依赖于前一个命令集的结果可以用这个变量判断。
同时可以把标准的错误输出重定向到一个log文件,记住如果t.txt不存在则
cat t.txt 2>log.log
此时$?为1,虽然上面的最后的重定向是成功的但是他记住的是上面的命令中是否产生了标准错误的输出




A beautiful web dashboard for Linux
最近提交(Master分支:17 天前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
更多推荐
所有评论(0)