shellenv: Fix shell detection
shellenv: Fix shell detection

It currently switches on `$SHELL`, which points to the user's login shell. However, `shellenv` may be used in contexts where the running shell isn't `$SHELL` (e.g. csh-based `cron` scripts), and Linux desktop environments may set up user sessions in ways that trip up the current algorithm (see #7965 for an example). To work correctly in all circumstances and environments, its output should be determined by the context (calling shell) instead.

Fixes #7965.

Homebrew/brew,claui/brew,EricFromCanada/brew,mahori/brew,Homebrew/brew,JCount/brew,sjackman/homebrew,vitorgalvao/brew,konqui/brew,Homebrew/brew,reitermarkus/brew,reitermarkus/brew,JCount/brew,konqui/brew,reitermarkus/brew,nandub/brew,mahori/brew,vitorgalvao/brew,MikeMcQuaid/brew,EricFromCanada/brew,mahori/brew,claui/brew,JCount/brew,JCount/brew,sjackman/homebrew,EricFromCanada/brew,sjackman/homebrew,nandub/brew,claui/brew,reitermarkus/brew,mahori/brew,konqui/brew,MikeMcQuaid/brew,konqui/brew,MikeMcQuaid/brew,Homebrew/brew,EricFromCanada/brew,sjackman/homebrew,vitorgalvao/brew,vitorgalvao/brew,MikeMcQuaid/brew,nandub/brew,claui/brew,nandub/brew