ulimit -R missing; --help is out of sync

2020-12-17 Thread Denys Vlasenko
According to the source, -R should be setting RLIMIT_RTTIME, but it does not work: bash-5.0$ ulimit -R bash: ulimit: -R: invalid option ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] ..and looking at the above help, I notice letters I never saw. Lets try them? bash-5.0$ ulimit -b bash

Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Chet Ramey
On 12/17/20 11:58 AM, Léa Gris wrote: Le 17/12/2020 à 17:35, Chet Ramey écrivait : One problem I see with it is that it assumes the introduction of word splitting into mapfile, with the burden on the user to ensure that there are exactly two resultant fields. It is just meant to be a replaceme

Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Léa Gris
Le 17/12/2020 à 17:58, Léa Gris écrivait : Maybe (it is clearly open to discussion), the associative array mapping could be allowed to: - skip blank/comment only lines (1) - allow key without value - optionally trim trailing comment (1) Forgot about Bash built-in Regex engine: - allow using a

Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Léa Gris
Le 17/12/2020 à 17:35, Chet Ramey écrivait : One problem I see with it is that it assumes the introduction of word splitting into mapfile, with the burden on the user to ensure that there are exactly two resultant fields. It is just meant to be a replacement to looping on: IFS= read -r -d k v

Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Alex fxmbsw7 Ratchev
you can maybe implent dynamical runtime code decisons like runtime code for splitting definement On Thu, Dec 17, 2020, 17:36 Chet Ramey wrote: > On 12/17/20 10:13 AM, Chet Ramey wrote: > > On 12/17/20 9:29 AM, Léa Gris wrote: > >> Here is a Bash model of how, associative array support could be

Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Chet Ramey
On 12/17/20 10:13 AM, Chet Ramey wrote: On 12/17/20 9:29 AM, Léa Gris wrote: Here is a Bash model of how, associative array support could be added to mapfile, replacing the need for interpreted while-loop read and logic by a much more efficient improved mapfile built-in: Thanks for the propos

Re: mapfile associative array shim Was: Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Léa Gris
Shorty shim: ! { mapfile -A _/dev/null&&{ mapfile(){ local k v d=$'\n';local -n A=${*: -1:1};[ ${*: -2:1} = -A ]&&{ [ ${*:1:1} = -d ]&&d=${*:2:1};while read -rd "$d" k v||[[ -n $k && -n $v ]];do A[$k]=$v;done;:;}||command mapfile "$@";};} -- Léa Gris

mapfile associative array shim Was: Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Léa Gris
Here is an include shim to enable associative array support to mapfile or fall-back to regular mapfile if it has that support already: #!/usr/bin/env bash # mapfile_assoc_shim.bash ! { mapfile -A a /dev/null && { mapfile () { local k v d=$'\n' local -n A=${*: -1:1} [[ ${*: -2:1} =

Re: [feature request] add associative array support to mapfile

2020-12-17 Thread Chet Ramey
On 12/17/20 9:29 AM, Léa Gris wrote: Here is a Bash model of how, associative array support could be added to mapfile, replacing the need for interpreted while-loop read and logic by a much more efficient improved mapfile built-in: Thanks for the proposal. I'll consider it for a future version

[feature request] add associative array support to mapfile

2020-12-17 Thread Léa Gris
Here is a Bash model of how, associative array support could be added to mapfile, replacing the need for interpreted while-loop read and logic by a much more efficient improved mapfile built-in: #!/usr/bin/env bash kv_cr_stream () { printf 'key1=value1\nkey2=value=2\nkey 3=value3\n' } kv_