On 07/14/2017 03:13 PM, Greg Wooledge wrote:
> On Sat, Jul 15, 2017 at 02:59:41AM +0700, Robert Elz wrote:
>> IMO, if SHELL gets unset (it is usually initialised by login, or its
>> equivalent), it should simply stay unset, and not be set to anything,
>> until some user (or script) decides to set it again.
> 
> wooledg:~$ unset SHELL
> wooledg:~$ bash -c 'echo "$SHELL"'
> /bin/bash
> wooledg:~$ ksh -c 'echo "$SHELL"'
> /bin/sh
> wooledg:~$ zsh -c 'echo "$SHELL"'
> 
> wooledg:~$ tcsh -c 'echo "$SHELL"'
> SHELL: Undefined variable.
> 
> Looks like there's not much agreement here.
> 

Good thing is bash doesn't export SHELL if it wasn't already exported,
and most shells seem to preserve the value of SHELL exported by some
parent. I see mksh sets -x if SHELL was previously unset... I suppose
that might cause a problem in some scenario (but probably not).

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to