Re: something like PIPESTATUS for x="x$(false)$(true)"
From:
Eli Schwartz
Subject:
Re: something like PIPESTATUS for x="x$(false)$(true)"
Date:
Sun, 3 Nov 2019 10:39:30 -0500
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0
On 10/31/19 6:57 PM, Peng Yu wrote:
> The following example shows that bash can only get the last status code.
>
> Is it better to haveing sometiing like PIPESTATUS to be able to get
> all the status codes? Thanks.
>
> $ x="x$(false)"
> $ echo $?
> 1
> $ x="x$(false)$(true)"
> $ echo $?
> 0
Why not just use
$ x="x$(false)"
$ echo $?
1
$ x="$x$(true)"
$ echo $?
0
Why does bash itself need a new feature for this?
pipes, at least, do something special which you cannot really get back
statuses from without something like PIPESTATUS, don't they?
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc Description: OpenPGP digital signature
[Prev in Thread]
Current Thread
[Next in Thread]
Re: something like PIPESTATUS for x="x$(false)$(true)",
Eli Schwartz<=