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

2022-12-05 Thread Dale R. Worley
Andreas Schwab writes: >> 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

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

2022-12-05 Thread Chet Ramey
On 12/3/22 6:18 AM, Emanuele Torre wrote: `declare -f "something="' fails with the following error: Thanks for the report. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.edu

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

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

`declare -f "a="' fails unnecessarily

2022-12-03 Thread Emanuele Torre
`declare -f "something="' fails with the following error: $ declare -f 'a=x' bash: declare: cannot use `-f' to make functions $ f=a=x $ decalre -f -- "$f" bash: declare: cannot use `-f' to make functions That error is not very useful. Bash makes `declare -f' fail with that