Re: $? in a simple command with no command name

2021-09-02 Thread Robert Elz via austin-group-l at The Open Group
Date:Wed, 1 Sep 2021 19:04:12 +0100 From:Harald van Dijk Message-ID: <837d3b5b-ac61-98eb-2741-d667a78e2...@gigawatt.nl> | $? is defined as "Expands to the decimal exit status of the most recent | pipeline (see Pipelines)." I suspect this is just a slightly more

Re: $? in a simple command with no command name

2021-09-01 Thread Chet Ramey via austin-group-l at The Open Group
On 9/1/21 4:59 PM, (Joerg Schilling) wrote: "Chet Ramey via austin-group-l at The Open Group" wrote: Given the following: (exit 42) a=$? b=`false` b=$? echo $? $a $b Bash prints 1 42 1. The original (v7) bourne shell and the rest of the research line through v9 prints 1 1 (b is set to

Re: $? in a simple command with no command name

2021-09-01 Thread Joerg Schilling via austin-group-l at The Open Group
Scott Lurndal wrote: > On Wed, Sep 01, 2021 at 10:59:46PM +0200, Joerg Schilling via austin-group-l > at The Open Group wrote: > > > > Something called SVR4.2 does not really exist. It was a minor change > > compared > > to SvR4 announced by Novell short before they sold the Copyright to

Re: $? in a simple command with no command name

2021-09-01 Thread Scott Lurndal via austin-group-l at The Open Group
On Wed, Sep 01, 2021 at 10:59:46PM +0200, Joerg Schilling via austin-group-l at The Open Group wrote: > > Something called SVR4.2 does not really exist. It was a minor change compared > to SvR4 announced by Novell short before they sold the Copyright to SCO. SVR4.2 ES/MP became Unixware 2.01.

Re: $? in a simple command with no command name

2021-09-01 Thread Joerg Schilling via austin-group-l at The Open Group
"Chet Ramey via austin-group-l at The Open Group" wrote: > Given the following: > > (exit 42) > a=$? b=`false` b=$? > > echo $? $a $b > > Bash prints 1 42 1. > > The original (v7) bourne shell and the rest of the research line through v9 > prints 1 1 (b is set to the empty string). That

Re: $? in a simple command with no command name

2021-09-01 Thread Chet Ramey via austin-group-l at The Open Group
On 9/1/21 2:23 PM, Robert Elz via austin-group-l at The Open Group wrote: > Date:Wed, 1 Sep 2021 19:04:12 +0100 > From:Harald van Dijk > Message-ID: <837d3b5b-ac61-98eb-2741-d667a78e2...@gigawatt.nl> > > | Is there any statement that overrides the general

Re: $? in a simple command with no command name

2021-09-01 Thread Robert Elz via austin-group-l at The Open Group
Date:Wed, 1 Sep 2021 19:04:12 +0100 From:Harald van Dijk Message-ID: <837d3b5b-ac61-98eb-2741-d667a78e2...@gigawatt.nl> | Is there any statement that overrides the general definition to | explicitly make this unspecified? If not, the general definition applies

Re: $? in a simple command with no command name

2021-09-01 Thread Harald van Dijk via austin-group-l at The Open Group
On 01/09/2021 18:48, Robert Elz via austin-group-l at The Open Group wrote: Date:Wed, 1 Sep 2021 16:38:00 +0300 From:"=?UTF-8?B?T8SfdXo=?= via austin-group-l at The Open Group" Message-ID: | true | a=$? b=`exit 1` b=$? >`echo /dev/null; exit 2` |

Re: $? in a simple command with no command name

2021-09-01 Thread Oğuz via austin-group-l at The Open Group
1 Eylül 2021 Çarşamba tarihinde Robert Elz yazdı: > Date:Wed, 1 Sep 2021 16:38:00 +0300 > From:"=?UTF-8?B?T8SfdXo=?= via austin-group-l at The Open > Group" > Message-ID: qvsysq5nfzfxetr7yeq...@mail.gmail.com> > > | true > | a=$? b=`exit 1` b=$? >`echo

Re: $? in a simple command with no command name

2021-09-01 Thread Robert Elz via austin-group-l at The Open Group
Date:Wed, 1 Sep 2021 16:38:00 +0300 From:"=?UTF-8?B?T8SfdXo=?= via austin-group-l at The Open Group" Message-ID: | true | a=$? b=`exit 1` b=$? >`echo /dev/null; exit 2` | echo $? $a $b | Now, I wonder, what did I miss? That $? (the exit status) is

Re: $? in a simple command with no command name

2021-09-01 Thread Harald van Dijk via austin-group-l at The Open Group
On 01/09/2021 17:22, Geoff Clare via austin-group-l at The Open Group wrote: Harald van Dijk wrote, on 01 Sep 2021: The second problem is the redirection. Based on the above, command substitutions in a redirection are supposed to affect the exit status just as any other command substitution,

Re: $? in a simple command with no command name

2021-09-01 Thread Geoff Clare via austin-group-l at The Open Group
Harald van Dijk wrote, on 01 Sep 2021: > > The second problem is the redirection. Based on the above, command > substitutions in a redirection are supposed to affect the exit status just > as any other command substitution, but the standard says: > > 3. Redirections shall be performed as

Re: $? in a simple command with no command name

2021-09-01 Thread Harald van Dijk via austin-group-l at The Open Group
Hi, On 01/09/2021 14:38, Oğuz via austin-group-l at The Open Group wrote: Consider the following: true a=$? b=`exit 1` b=$? >`echo /dev/null; exit 2` echo $? $a $b Having read the relevant sections of the standard a couple times, I would expect the output to be `1 0 0'; I agree.

$? in a simple command with no command name

2021-09-01 Thread Oğuz via austin-group-l at The Open Group
Consider the following: true a=$? b=`exit 1` b=$? >`echo /dev/null; exit 2` echo $? $a $b Having read the relevant sections of the standard a couple times, I would expect the output to be `1 0 0'; but that's not the case with most shells. Below are what each shell I have on my computer output

What does the standard say about whether assignments are visible for subsequent expansions in a simple command without a command name?

2016-11-07 Thread Mark Galeck
Hello, the current shell standard says in Section 2.9.1: --- If no command name results, variable assignments shall affect the current execution environment. If the command name is not a special built-in utility or function, the variable assignments (...) shall not affect the