Le 22/01/2021 à 16:11, pepa65 écrivait :
I still love the idea of ">>>variable" to direct output into a
variable without needing a subshell
I'd prefer a syntax based off:
command-list > >(command-list)
command-list < <(command-list)
But with curly braces for the no sub-shell version:
command-list > >{ command-list;}
command-list < <{ command-list;}
Which could be used to assign output of a command to a variable without
a sub-shell:
Example:
mapfile -t users < <{ compgen -u; } # No sub-shell
Implementation-wise it could be a temporary file in /tmp or /dev/shm
rather-than a temporary named fifo as with < <(:).
--
Léa Gris