[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Detecting shell type (ie: is/non interactive/ssh/login s
From: |
Bob Proulx |
Subject: |
Re: [Help-bash] Detecting shell type (ie: is/non interactive/ssh/login shell) |
Date: |
Fri, 9 Sep 2016 19:30:18 -0600 |
User-agent: |
NeoMutt/ (1.7.0) |
Assaf Gordon wrote:
> Instead of just asking if the shell is interactive or not, you
> likely want to know if the current session (inside your
> guake/konsole) is "busy" or not, i.e. what is running in the
> foreground.
>
> I would suggest investigating an existing program that already tries
> to do such thing: tmux . tmux ( the screen multiplexer
Well... That is a little different case. In that case the tmux (and
screen) program is the parent. The shell is running as a child
process. Parents can know a lot of information about their children
processes and can watch over them. That's all okay. And I am fine
with a parent observing the child and displaying what it is doing.
The part I didn't like is where the script program was trying to guess
intentions from the caller. Was it intended to run as an interactive
script? Intended to be a login script? Intended to be running from
ssh from a remote system? I don't think it is possible to guess the
caller's intentions. And trying to do so in fragile ways creates a
program maintenance problem. Remove those things and then I am happy
with things again.
> I know nothing about guake/konsole, but I would naively guess that
> you can know what is the shell process you've started inside it, and
> if it's not the 'active' one in the foreground, the console session
> is 'busy' (likely there will be many possible complications in
> practice, but still....).
If the question is how can a guake/konsole/something program know what
its children are doing then that is a completely different problem. I
think what tmux is doing is too much creeping featurism. But it is in
an okay place to be doing it.
Bob