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]']=val2 ) printf -v serialized "%q " "${*hash[@]}" typeset -A deserialized_hash eval "deserialized_hash=($serialized)"I don't get it.
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. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature