On Thu, Dec 22, 2016 at 09:32:37AM -0500, Chet Ramey wrote: > I haven't thought about it too much, but I'm initially reluctant to put > this into the mainline source, when it seems like it could be accomplished > without any source changes at all.
A lot of "new" functionality added in each release could be implemented in Bash itself using functions and / or external programs, so I don't understand this sentiment as a rationale. Off the top of my head, I think the "%T(...)" time formatting which can be achieved with many implementations of date(1) is a great example of this. That aside, implementing this without changes to Bash's C source code requires the use of a DEBUG trap, PS0 or potentially PS1. Using stty in a DEBUG trap the obvious way (simply "stty susp undef") would sometimes result in "jobs" being non-empty when I otherwise had no other programs in the background. I ultimately resolved this by running stty in a subshell i.e. "stty susp undef" became "$(stty susp undef)", but I think the fact that the obvious way of doing this is Bash doesn't work perfectly suggests that it would be better implemented in C. Changing VSUSP natively is also far faster than calling stty. Eric