Le 22/01/2021 à 19:18, Léa Gris écrivait :
Now replace the the () with {}, replace the implicit temporary fifo by and implicit temporary file; then have the same feature but without spawning a sub-shell.


Instead of:

tempfile=$(mktemp) || exit 1
trap 'rm -f "$tempfile"' EXIT
compgen -u >"$tempfile"
mapfile -t users <"$tempfile"

You'd have:

mapfile -t users < <{ compgen -u;}

--
Léa Gris


Reply via email to