Skip to content

Instantly share code, notes, and snippets.

@dermoth
dermoth / gist:9337183
Last active August 29, 2015 13:56
Bash (()) and error handling
[thomas_guyot@localhost ~]$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
[thomas_guyot@localhost ~]$ trap 'echo Argh' ERR
[thomas_guyot@localhost ~]$ variable=0
[thomas_guyot@localhost ~]$ ((variable++))
[thomas_guyot@localhost ~]$ echo $?
1
[thomas_guyot@localhost ~]$ echo $variable
1