News for hackers. Stuff that matters.
Re:Bash functions are better than I thought by tomjakubowski on Sunday October 31, 2021 @09:04PM (#29062064)
> 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.

Re:Bash functions are better than I thought by kps on Sunday October 31, 2021 @09:11PM (#29062095)
Bash does have `typeset -n` (from ksh) which allows shell variables to be passed to a function by reference.
Re:Bash functions are better than I thought by cryptonector on Sunday October 31, 2021 @10:55PM (#29062624)
Yes, and which gets you Tcl-ish pass by name semantics.
Re:Bash functions are better than I thought by tomjakubowski on Tuesday November 02, 2021 @09:54PM (#29090218)
Cool, thanks!