sh 如何在bash中执行try / catch块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 如何在bash中执行try / catch块相关的知识,希望对你有一定的参考价值。

# by: Cody Kochmann

# as a one liner
try_command || catch_command

# as a multi liner
{ 
  try_command_a && \
  try_command_b
} || { 
  catch_command_a && \
  catch_command_b
}

以上是关于sh 如何在bash中执行try / catch块的主要内容,如果未能解决你的问题,请参考以下文章