I upgraded a Debian box from stable to Jessie and I noticed that SHELL is no longer exported, so screen and similar programs start dash for subshells instead of bash.

When was this change made and why?

  • 1
    I do not think it is the shell that exports SHELL environment variable. I think it is exported at the level of OS. – mkc Mar 2 '15 at 1:48

A long, long time ago:

This document details the changes between this version, bash-2.05a-rc1, and the previous version, bash-2.05a-beta1.

  1. Changes to Bash

w. Bash no longer auto-exports HOME, PATH, SHELL, or TERM, even though it gives them default values if they don't appear in the initial environment.

I don't know what the reason is, but it makes sense: there's no reason that running a bash script should set SHELL for inferior processes if it was unset. Bash only exports PWD (because it's supposed to, for whatever good that does), OLDPWD (the companion of PWD) and SHLVL (which is supposed to always be set by shells).

The reason SHELL is normally set to your login shell is that it's set in the environment by the login program (login, sshd, etc.). This should still be the case in jessie. If some login method doesn't set SHELL, that's probably a bug in the login method.

  • This is fun, given that I haven't used a version of bash older than four for long enough to have quit checking version in scripts and both xdm and ssh logins started showing the change in behaviour . . . it must be pam. – hildred Mar 2 '15 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.