[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bogus value of variable BASH
From: |
David Hunt |
Subject: |
Re: Bogus value of variable BASH |
Date: |
Fri, 12 Feb 2016 10:38:55 -0500 |
I'm not trying to write scripts that rely on the value of BASH. I only
discoverd the discrepancy while investigating the potential usefulness
of various variables set by the shell. Perhaps I just don't get the
point of having the variable in the first place.
Also I'm not very fond of Ubuntu's pointing /bin/sh to dash rather
than bash. That seems sacrilegious, in my opinion.
David Hunt
On 2/9/16, Chet Ramey <chet.ramey@case.edu> wrote:
> On 2/8/16 7:09 PM, David Hunt wrote:
>
>> Bash Version: 4.3
>> Patch Level: 11
>> Release Status: release
>>
>> Description:
>> On my notebook running Ubuntu 14.04.3 LTS /bin/sh points to dash, not
>> bash.
>> To get sh behaviour from bash I use the command `exec -a sh /bin/bash'.
>> When I do so bash sets BASH to /bin/sh, which it demonstrably is not.
>
> Bash sets the BASH variable from $0. If $0 is a full pathname, it's used
> directly, otherwise it's looked up in $PATH. That algorithm is not
> foolproof, and one way to fool it is to disguise the program name.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
>