[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] eval and set -e
From: |
Peng Yu |
Subject: |
[Help-bash] eval and set -e |
Date: |
Mon, 15 May 2017 20:04:12 -0500 |
Hi,
I have the following code.
The exit code of the first eval is 1. The exit code of the second eval
is supposed to be 1 as well, so I'd expect the last echo to print the
exit code. But I don't see it.
Does anybody know how to understand this code?
$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
( eval 'set -e; false; echo xx' )
echo xxx "$?"
( eval 'set -e; false; echo xx' ) || echo "$?"
$ ./main.sh
xxx 1
xx
--
Regards,
Peng
- [Help-bash] eval and set -e,
Peng Yu <=