Antw: [EXT] Re: declare XXX=$(false);echo $?

2022-12-04 Thread Ulrich Windl
>>> Martin D Kealey schrieb am 03.12.2022 um 02:26 in Nachricht : ... > Found in the real code (intended to trigger a bug): >> declare ERRORS=0 ARGS=$(getopt -o "$S_OPTS" -l "$L_OPTS" -n "$0" -- >> "$@") >> > if [ $? -ne 0 ]; then >> usage >> fi >> > > That is a well-known a

Antw: [EXT] Re: declare XXX=$(false);echo $?

2022-12-04 Thread Ulrich Windl
Dale, thanks for explaining. So basically the behavior is as documented (not a bug), but the design decision was poor: declare a a=b has a different semantic as declare a=b which I consider to be bad. Ulrich >>> "Dale R. Worley" schrieb am 02.12.2022 um 17:39 in Nachricht <878rjpahfz..

Re: `declare -f "a="' fails unnecessarily

2022-12-04 Thread Andreas Schwab
On Dez 04 2022, Dale R. Worley wrote: > In default mode, you actually can do > $ function a=b { printf hi\\n; } > though you can't execute it: > $ a=b foo > bash: foo: command not found You just have to quote any part of the function name upto the equal sign to stop if from being inte

Re: `declare -f "a="' fails unnecessarily

2022-12-04 Thread Dale R. Worley
Emanuele Torre writes: > `declare -f "something="' fails with the following error: > > $ declare -f 'a=x' > bash: declare: cannot use `-f' to make functions > That error is not very useful. Bash makes `declare -f' fail with that > error when an argument looks like an assignment. It's an