Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
syntax:ccmd:grouping_plain [2010/11/13 12:45]
127.0.0.1 external edit
syntax:ccmd:grouping_plain [2016/06/02 20:49] (current)
samuelwn [Examples] Simple try-catch block
Line 38: Line 38:
  
 ===== Examples ===== ===== Examples =====
 +==== A Try-Catch block ====
  
 +    try_catch() { 
 +        { # Try-block:​ 
 +            eval "​$@"​ 
 +        } || 
 +        { # Catch-block:​ 
 +            echo "An error occurred"​ 
 +            return -1 
 +        } 
 +    }
 ===== Portability considerations ===== ===== Portability considerations =====
  
  • syntax/ccmd/grouping_plain.1289652345.txt
  • Last modified: 2016/06/02 20:49
  • (external edit)