Re: Handling files with CRLF line ending

2022-12-05 Thread Chet Ramey
On 12/3/22 8:53 AM, Yair Lenga wrote: Thank you for suggestions. I want to emphasize: I do not need help in striping the CR from the input files - it's simple. The challenge is executing a working bash/python solution from Linux on WSL, with MINIMAL changes to the scripts. That's certainly

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' does not output the "function" keyword when required

2022-12-05 Thread Chet Ramey
On 12/3/22 6:05 AM, Emanuele Torre wrote: In Bash, it is possible to define functions that look like assignment words using the function keyword: function a=2 { printf hi\\n ;} When `declare -f' is used to output all the function definitions, bash will not output that function definition

Re: declare XXX=$(false);echo $?

2022-12-05 Thread Chet Ramey
On 12/2/22 8:26 PM, Martin D Kealey wrote: If anything is weird, it's that simple (bare) assignments set $? to 0 UNLESS there's a command substitution providing a status. Why not, if the assignment is performed successfully? POSIX says all errors in that context are fatal for non-interactive

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

2022-12-05 Thread Lawrence Velázquez
On Mon, Dec 5, 2022, at 2:47 AM, Ulrich Windl wrote: > 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. You're free to think so, but this behavior is