bug-bash
[Top][All Lists]
Advanced

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

Re: Finding the last foreground command in the current session


From: Stephane Chazelas
Subject: Re: Finding the last foreground command in the current session
Date: Fri, 22 May 2015 14:38:31 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2015-02-05 13:18:43 +0000, Debarshi Ray:
> Hey,
> 
> I work on gnome-terminal. I am trying to add support for notifying the
> user when a long-running command finishes in an inactive tab or
> window.  I am currently emitting a custom escape sequence [1] from
> PROMPT_COMMAND, with the command parsed from $(history 1) as an
> argument.
[...]

Can you not just do a tcgetpgrp() periodically (or upon tty
setting change since modern shells change the tty settings
when entering and leaving their prompt) on the pseudo-tty
(doing it on the master side seems to work as well at least on
Linux) and use the names of the processes in that group (from
/proc for instance)?

That would have the advantage of being shell-agnostic.

-- 
Stephane




reply via email to

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