[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shebang-less script execution not resetting some options
From: |
Chet Ramey |
Subject: |
Re: shebang-less script execution not resetting some options |
Date: |
Tue, 1 Oct 2019 10:16:45 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 10/1/19 7:14 AM, L A Walsh wrote:
> On 2019/09/30 14:39, Grisha Levit wrote:
>> A few of the recently-added shopt options aren't getting reset when
>> running a shebang-less script, this should fix it up:
>>
> Suppose the shebang-less script is being run by an earlier version
> of bash. Won't the new patch radically change the behavior of of
> such programs?
No.
> Does posix define the behavior of a child script with no interp-line?
"If the execl() function fails due to an error equivalent to the [ENOEXEC]
error defined in the System Interfaces volume of POSIX.1-2017, the shell
shall execute a command equivalent to having a shell invoked with the
pathname resulting from the search as its first operand, with any remaining
arguments passed to the new shell, except that the value of "$0" in the new
shell may be set to the command name."
POSIX doesn't define any executable formats, including #!.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/