On 2/17/24 6:40 AM, John Larew wrote:
This is a portion of a script that appears to be problematic. Each of these attempts appear to be valid; none of them work. The issue is apparent with bash in both termux v0.118.0/5.22.6 and Ubuntu v22.04.3 LTS/5.1.16 (see attached).
The clue is in the error message (and its subsequent variants): fg: current: no such job which means that there are no background jobs in the execution environment where `fg' is executed. The background job in constructs like ( sleep 15s; set -m; fg %+; exit) & ( sleep 15s; set -m; fg %%; exit) & is in the parent shell's execution environment; the subshell has no background jobs of its own. In constructs like ( sleep 15s; set -m; fg $$; exit) & ( sleep 15s; set -m; fg $!; exit) & `fg' doesn't take PID arguments. (The reason you get the `current' in the error message is that $! expands to nothing if there haven't been any background jobs created, and `fg' without arguments defaults to the current job.) -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature