bug-bash
[Top][All Lists]
Advanced

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

Re: Return status of command substitution with $(...) "gets lost"


From: Eric Blake
Subject: Re: Return status of command substitution with $(...) "gets lost"
Date: Thu, 11 Mar 2010 09:32:36 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3

On 03/11/2010 09:27 AM, Marc Herbert wrote:
> Chet Ramey wrote:
> 
>> To Posix, assignment statements never fail -- assignment errors cause
>> non- interactive shells to exit, period.  In that case, it's possible
>> to reflect the exit status of a command substitution in the exit
>> status of a command consisting only of assignment statements,...
> 
> It's possible... and required by POSIX, right? 

POSIX says nothing about local.  But yes, POSIX requires that:

a=$(b)

set $? to the status of running the command substitution.

> Here you seem to imply this is actually an "advanced" and thus
> non-standard feature (why I have no clue). An unreliable feature would
> never have been standardized for sure...

The question at hand is whether:

local a=$(b)

should set the exit status to the command substitution (a change in
behavior), or to the status of running the 'local' command (the current
behavior).  I threw out the question about change as a discussion point,
but I'm perfectly fine with Chet's response that the current behavior
will stay as is.

If you'd like 'local' to be standardized in the next version of POSIX,
several years from now, that would also be a good goal; help in
submitting the proposal to the Austin group would be appreciated.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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