Cipherd@lemmy.ml to Programmer Humor@programming.dev · 2 days agofunctionslemmy.mlexternal-linkmessage-square119fedilinkarrow-up1650arrow-down19file-text
arrow-up1641arrow-down1external-linkfunctionslemmy.mlCipherd@lemmy.ml to Programmer Humor@programming.dev · 2 days agomessage-square119fedilinkfile-text
minus-squareCaveman@lemmy.worldlinkfedilinkarrow-up1·1 day 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 day 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?