• SlurpingPus@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    14 hours ago

    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’.

    • Laser@feddit.org
      link
      fedilink
      arrow-up
      2
      ·
      11 hours ago

      Functions are definitely not subshells in Bash

      You’re right, my bad, I got this mixed up with something else.

      • SlurpingPus@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        7 hours ago

        I’m gonna bet yes for the simple reason that various helper scripts exist that do advanced cd history, with fuzzy search and whatnot, and they can’t be implemented as anything other than functions.