On 19/05/15 14:04, Pádraig Brady wrote:
> On 19/05/15 13:45, Mike Frysinger wrote:
>> On 19 May 2015 12:42, Pádraig Brady wrote:
>>> * tests/cp/no-ctx.sh: Scope of `var=val func` is inconsistent
>>> across shells, so avoid that construct with functions.
>>
>> i think POSIX requires the behavior dash exhibits, and bash will do the same 
>> when it's in POSIX compliant mode.
> 
> Right http://pubs.opengroup.org/onlinepubs/9699919799//utilities/read.html

Oops, I referred to the wrong thing here :)

bash --posix is like sh in this regard.
dash and ksh were different again.

for SH in sh bash 'bash --posix' dash ksh; do
  echo $SH; $SH -c "f() { sh -c 'echo \$VAR'; }; VAR=42 f; f"
done

sh
42
42

bash
42


bash --posix
42
42

dash



ksh



cheers,
Pádraig.

Reply via email to