Re: "${assoc[@]@k}" doesn't get expanded to separate words within compound assignment syntax

2024-03-22 Thread Greg Wooledge
On Fri, Mar 22, 2024 at 02:09:23PM -0400, Lawrence Velázquez wrote: > On Fri, Mar 22, 2024, at 12:54 PM, Greg Wooledge wrote: > > Also, I don't see the lower-case k transformation in the man page. > > It's at the end of the list: > > https://git.savannah.gnu.org/cgit/bash.git/tree/doc/bash.1?id=f

feat: exit 1 "file not found"

2024-03-22 Thread teknopaul
Hi not sure if this is the correct forum... exit builtin accepts one and only one arg currently. Would it be backwards compatible and generally useful to support echoing a reason for exiting? test -f file || exit 2 "file not found" good bash scripters handle and report errors have seen lots

Re: "${assoc[@]@k}" doesn't get expanded to separate words within compound assignment syntax

2024-03-22 Thread Lawrence Velázquez
On Fri, Mar 22, 2024, at 12:54 PM, Greg Wooledge wrote: > Also, I don't see the lower-case k transformation in the man page. It's at the end of the list: https://git.savannah.gnu.org/cgit/bash.git/tree/doc/bash.1?id=f3b6bd1#n3525 -- vq

Re: "${assoc[@]@k}" doesn't get expanded to separate words within compound assignment syntax

2024-03-22 Thread Greg Wooledge
On Fri, Mar 22, 2024 at 11:23:35AM -0400, Chet Ramey wrote: > This is what you can do with @K. > > https://lists.gnu.org/archive/html/bug-bash/2021-08/msg00119.html > > Word splitting doesn't happen on the rhs of an assignment statement, so you > use eval. The @K quoting is eval-safe. It would b

Re: Bash printf should diagnose integer overflow

2024-03-22 Thread Chet Ramey
On 3/22/24 2:40 AM, Paul Eggert wrote: $ diff -u :check[34].log --- :check3.log    2024-03-21 14:09:48.069094929 -0700 +++ :check4.log    2024-03-21 22:39:51.391869014 -0700 @@ -327,6 +327,10 @@  warning: UNIX versions number signals and schedule processes differently.  warning: If output differ

Re: "${assoc[@]@k}" doesn't get expanded to separate words within compound assignment syntax

2024-03-22 Thread Chet Ramey
On 3/20/24 10:16 AM, Zachary Santer wrote: and then uses eval in his examples of how Bash could incorporate similar behavior: array=( val1 "val2*[special-chars]" ) printf -v serialized "%q " "${array[@]}" eval "deserialized=($serialized)" declare-A hash=( [key1]=val1 ['key2*[special-chars]'