2 ms·
> So you can't define an array in a subshell and then use it outside the subshell, and you can't return an array (or anything that isn't a string) from a subshe
by tomjakubowski 5y ago
> So you can't define an array in a subshell and then use it outside the subshell, and you can't return an array (or anything that isn't a string) from a subshell
Huh. How does one return a value from a bash function? I've always only ever seen the "echo calling convention" used in scripts, or use of global variables.
- kps 5y agoBash does have `typeset -n` (from ksh) which allows shell variables to be passed to a function by reference.
- cryptonector 5y agoYes, and which gets you Tcl-ish pass by name semantics.
- tomjakubowski 5y agoCool, thanks!