Cipherd@lemmy.ml to Programmer Humor@programming.dev · 1 year agofunctionslemmy.mlimagemessage-square119fedilinkarrow-up1666file-textcross-posted to: programmerhumor@lemmy.ml
arrow-up1666imagefunctionslemmy.mlCipherd@lemmy.ml to Programmer Humor@programming.dev · 1 year agomessage-square119fedilinkfile-textcross-posted to: programmerhumor@lemmy.ml
minus-squareCaveman@lemmy.worldlinkfedilinkarrow-up1·1 year agoTurns out you can, by using () instead of {} in the function declaration you can run the function in a subshell where changes to variables are scoped to the subshell and functions are local.
minus-squareLaser@feddit.orglinkfedilinkarrow-up1·1 year agoThat doesn’t help you if you want to get the result of something that happened in the function without capturing stdout, does it?
Turns out you can, by using () instead of {} in the function declaration you can run the function in a subshell where changes to variables are scoped to the subshell and functions are local.
That doesn’t help you if you want to get the result of something that happened in the function without capturing stdout, does it?