linux – 如果在Bash中工作,我怎么能这样做?

linux – 如果在Bash中工作,我怎么能这样做?,第1张

概述在bash中如何使这样的结构工作: if (cp /folder/path /to/path) && (cp /anotherfolder/path /to/anotherpath)then echo "Succeeded"else echo "Failed"fi if应该测试$?返回每个命令的代码并将它们与&&联系起来. 我怎样才能在Bash中做到这一点? if cp /folde 在bash中如何使这样的结构工作:

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中工作,我怎么能这样做?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/1029083.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存