[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "jobs" builtin: print zero exit status
From: |
Dmitry Bolshakov |
Subject: |
Re: "jobs" builtin: print zero exit status |
Date: |
Sat, 14 Sep 2013 16:14:23 +0400 |
"wait" blocks, "jobs" - does not
--
with best regards
Dmitry Bolshakov
12.09.2013, 22:34, "Chet Ramey" <chet.ramey@case.edu>:
> On 9/12/13 6:14 AM, Dmitry Bolshakov wrote:
>
>> Hi!
>> imho "jobs" should either print zero exit status or it should be
>> documented that "Done" means zero exit status
>> $ bash -c 'set -m; perl -e "sleep 1; exit 123"& { sleep 3; jobs -l; }'
>> [1]+е║ Exit 123е║е║е║е║е║е║е║е║е║е║е║е║е║е║е║ perl -e "sleep 1; exit 123"
>> ok, I see exit status
>> but
>> $ bash -c 'set -m; perl -e "sleep 1; exit 0"& { sleep 3; jobs -l; }'
>> [1]+е║ Doneе║е║е║е║е║е║е║е║е║е║е║е║е║е║е║е║е║е║е║ perl -e "sleep 1; exit
>> 0"
>> imho "Exit 0" would be better for scripting
>
> The format of the text isn't in the man page at all. Parsing the output
> of jobs is a really terrible way to figure out a job's exit status. You
> might try using `wait'.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/