[Toybox] Would someone please explain what bash is doing here?
Chet Ramey
chet.ramey at case.edu
Fri May 29 11:09:03 PDT 2020
On 5/28/20 6:41 PM, Rob Landley wrote:
>> If you support job control IDs, you're already supporting `%' as a special
>> prefix. What's the difference?
>
> I meant we've resolved that % is one prefix and %? is another prefix with
> similar but distinct meaning. I.E. %? is, itself, a special prefix.
I suppose. But it's the `%' that marks the argument as a job identifier.
The rest of the string is what's interpreted.
>> If you're worried about leaving stray background jobs around, end your
>> test script with `wait'.
>
> Which will hang if the background job is hung.
It's pretty easy to send yourself a signal from a subshell after a period
of time as a cheap alarm.
>
>> But you can always save a background job's pid
>> by saving $!, so you can always have a handle to the background jobs you
>> create.
>
> In theory jobs -p should do it, in practice I've hit background-from-subshell
> cases where it wasn't in the list...
Sure, you can defeat anything. I've done stuff like that myself to avoid
processes being killed by the shell at exit.
>
>> Bash-5.1 will change the way it does $SECONDS to use gettimeofday(), btw.
>
> Meanwhile, I'm fielding:
>
> https://github.com/landley/toybox/pull/210
Ironically, gettimeofday() is more portable.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet at case.edu http://tiswww.cwru.edu/~chet/
More information about the Toybox
mailing list