[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] set -e and CMD_IGNORE_RETURN question
From: |
Kolya |
Subject: |
[Help-bash] set -e and CMD_IGNORE_RETURN question |
Date: |
Wed, 7 Mar 2018 21:18:25 +0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
Hello!
I have many troubles, when call function inside test statement, or
something like this:
set -e
f() {
false
echo 1
}
f && echo ok
if [ "$(f)" == "1" ] ...
Generally, i do not want "echo 1" execute, i want catch "false" by set -e.
I understand the mail logic of how it work.
I look in source, bash set CMD_IGNORE_RETURN option and not possible to
drop it down. It require, because bash executor always call err_trap
when get error.
Question is: this is bash-interpreter coding problem only, or something
else? Can me (or someone) do new option, like set -e, what won't be
ignored inside functions? (maybe need do something like
exception-handling, or other ways). Or this is conceptual problem and
this option newer can be implemented?
Thanks!
- [Help-bash] set -e and CMD_IGNORE_RETURN question,
Kolya <=