nithir revised this gist . Go to revision
No changes
nithir revised this gist . Go to revision
No changes
nithir revised this gist . Go to revision
1 file changed, 1 insertion
main.sh
| @@ -3,5 +3,6 @@ set -euo pipefail | |||
| 3 | 3 | ||
| 4 | 4 | # Set a trap to handle errors and log them. | |
| 5 | 5 | trap 'echo "Error occurred at line $LINENO. Command: $BASH_COMMAND"' ERR | |
| 6 | + | # https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-LINENO | |
| 6 | 7 | ||
| 7 | 8 | false | |
nithir revised this gist . Go to revision
2 files changed, 9 insertions
main.sh(file created)
| @@ -0,0 +1,7 @@ | |||
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | set -euo pipefail | |
| 3 | + | ||
| 4 | + | # Set a trap to handle errors and log them. | |
| 5 | + | trap 'echo "Error occurred at line $LINENO. Command: $BASH_COMMAND"' ERR | |
| 6 | + | ||
| 7 | + | false | |
output.shell(file created)
| @@ -0,0 +1,2 @@ | |||
| 1 | + | % ./main.sh | |
| 2 | + | Error occurred at line 7. Command: false | |