Functions are definitely not subshells in Bash, seeing as anything modifying the environment, like pyenv and such, is implemented as functions instead of scripts — specifically because functions are run in the same shell instance.
Unless ‘subshell’ means something in the vein of ‘like a new shell, but not really’.
Functions are definitely not subshells in Bash, seeing as anything modifying the environment, like
pyenvand such, is implemented as functions instead of scripts — specifically because functions are run in the same shell instance.Unless ‘subshell’ means something in the vein of ‘like a new shell, but not really’.
Try doing
cdinside a function and thenpwdin the main script. Does it move the main script too?You’re right, my bad, I got this mixed up with something else.