On 12/24/14 6:51 AM, Ed Avis wrote:
> At an interactive bash prompt, run a 'for' loop:
> 
> % for i in a b c; do echo $i; sleep 10; done
> 
> Then interrupt this with Ctrl-Z.  The process interrupted is just whichever
> sleep process was running at the time.  You can then resume it with 'fg' but
> the loop does not continue.
> 
> I understand that job control applies to processes and that bash does not
> create a new process to run a 'for' loop.  You can force it to do so:
> 
> % (for i in a b c; do echo $i; sleep 10; done)
> 
> Now job control does something more sensible; the whole loop can be paused,
> put into the background or the foreground.  But if you didn't have the
> foresight to put () around your command, you are stuck if you later decide
> you want to put it in the background.
> 
> Is there something bash could do to be more user-friendly here?

Such a feature has been in the wish list category for a while, but it has
not risen high enough on the priority list for me to tackle an
implementation.  I would be happy to look at a code contribution to
implement it.

Chet

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

Reply via email to