|
From: | Léa Gris |
Subject: | Re: mapfile associative array shim Was: Re: [feature request] add associative array support to mapfile |
Date: | Thu, 17 Dec 2020 16:51:25 +0100 |
User-agent: | Telnet/1.0 [tlh] (PDP11/DEC) |
Shorty shim:! { mapfile -A _</dev/null;} 2>/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
[Prev in Thread] | Current Thread | [Next in Thread] |