
if (cp /folder/path /to/path) && (cp /anotherfolder/path /to/anotherpath)then echo "Succeeded"else echo "Failed"fi
if应该测试$?返回每个命令的代码并将它们与&&联系起来.
我怎样才能在Bash中做到这一点?
解决方法if cp /folder/path /to/path /tmp && cp /anotherfolder/path /to/anotherpath ;then echo "ok"else echo "not"fi总结
以上是内存溢出为你收集整理的linux – 如果在Bash中工作,我怎么能这样做?全部内容,希望文章能够帮你解决linux – 如果在Bash中工作,我怎么能这样做?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)