bug-bash
[Top][All Lists]
Advanced

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

Re: CTL-z bug?


From: Chet Ramey
Subject: Re: CTL-z bug?
Date: Tue, 13 Jan 2015 21:02:14 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 1/13/15 11:37 AM, Guillaume MULLER wrote:
> Hi,
> 
> When I run a for loop in bash, then pausing it with CTL-z, then restarting
> it with fg, the for loop just stops. I don't think this was the behaviour
> until recently, and I don't find it a correct behaviour, according to the
> meaning of the CTL-z "suspend" (https://en.wikipedia.org/wiki/Control-Z).
> Is there any explanation to this behaviour?

SIGTSTP works at the process or job level, not the shell compound command
level.  When you stop the current job with ^Z, the shell has a choice to
make: continue with the loop, or break out of it.  There isn't a handle to
suspend the entire loop's execution, since it doesn't execute in a
separate process.  Bash chooses to break the loop, and has done so for a
very long time (at least back to bash-3.0, which was released ten years
ago, at which point I stopped looking).

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/



reply via email to

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