I have this function,
rpargs () {
local i
args=()
for i in "$@"
do
test -e "$i" && args+="$(realpath --canonicalize-existing -- "$i")" || args+="$i"
done
}
And I want to return args. The only ways I can think of are either to printf '%s\0' and then split it via expansion flags (0@), or to use a global like the code above.