[Top][All Lists]

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

Re: Checking executability for asynchronous commands

From: Chet Ramey
Subject: Re: Checking executability for asynchronous commands
Date: Fri, 25 Dec 2020 16:51:56 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 12/25/20 4:40 AM, Markus Elfring wrote:

I am looking for another bit of clarification according to an implementation 

The manual is providing the following information.

        If  a command is terminated by the control operator &, the shell 
executes the command in the background in a subshell.  The shell does not wait for 
the command to finish, and the
        return status is 0.

Thus I observe a behaviour like the following for a simple test with the
software “bash 5.0.18-3.1” according to a “program” which does not exist here.

elfring@Sonne:~> xy &
[1] 4063
xy: Befehl nicht gefunden
[1]+  Exit 127                xy

Yes, the child process exits with status 127, but $? is set to 0, as POSIX
requires. If you want the exit status of the child process, add `wait $!'
when you are ready to use the status, which will set $? to 127.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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