即使命令失败,bash也会成功

时间:2016-03-16 19:21:42

标签: bash shell chef git-bash

我有一个包含多个命令的bash脚本:

code <<-EOH
  yum -y install httpd && yum -y install mod_ssl
  cd /tmp
  git clone https://github.xxx
  cd /tmp/docker-oidc-rp
  cp modules/centos/x86_64/apache22/mod_wsja.cl2.so /etc/httpd/modules
  cp int/ce-conf/*.* /etc/httpd/conf/mod_mon-ce
  echo "Include /etc/httpd/conf/mod_mon-ce/wsjacl2.conf" >> /etc/httpd/conf/httpd.conf
  echo "modmon recipe executed successfully"
  EOH

现在我有多个命令,我想按顺序运行,如果它们失败,那么我想用失败消息/错误退出bash但是即使命令失败,它也会移动到其他命令然后给出成功消息对于bash。

什么是最简洁的方法,使所有命令等待前面的命令成功,如果出现任何错误,则退出bash。

0 个答案:

没有答案
相关问题