Kolya
2018-03-07 16:18:25 UTC
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!
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!