coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: fix non POSIX constructs causing failures with dash


From: Pádraig Brady
Subject: Re: [PATCH] tests: fix non POSIX constructs causing failures with dash
Date: Tue, 19 May 2015 14:14:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

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

[Prev in Thread] Current Thread [Next in Thread]