Re: detect if shell is running standalone or from mc
Jörg Thümmler <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.mc.general |
|---|---|
| Message-ID | <[email protected]> |
Am 03.07.21 um 14:06 schrieb Fourhundred Thecat via mc: > Hello, > > how can I determine in a shell, whether the shell is running standalone > or in mc? > > I am using zsh, and I have few aliases defined. > > I would like to change behavior of the alias, depending whether I am in > mc or not. > > How can I detect it in the shell, that I am currently in mc? > > thanks, > _______________________________________________ > mc mailing list > https://mail.gnome.org/mailman/listinfo/mc Hi, you may use ps therefore. The mc bash starts a pseudo-tty (ptsXX), if mc is running in a pts itself (Graphic desktop) the mc shell uses a new one: $ ps ax 11914 ? Sl 0:01 \_ xfce4-terminal 24794 pts/13 Ss 0:00 \_ bash 24935 pts/13 S+ 0:00 \_ /usr/bin/mc -P /tmp/mc-joe/mc.pwd.24794 24940 pts/14 Ss 0:00 \_ bash -rcfile .bashrc 10732 pts/14 R+ 0:00 \_ ps axf and ps xf | grep "/usr/bin/mc" 24935 pts/13 S+ 0:00 \_ /usr/bin/mc -P /tmp/mc-joe/mc.pwd.24794 7211 pts/14 S+ 0:00 \_ grep --color=auto /usr/bin/mc shows "grep" running in separate pts while running "ps" without mc "ps" uses the same pts: 11914 ? Sl 0:02 \_ xfce4-terminal 24794 pts/13 Ss 0:00 \_ bash 12263 pts/13 R+ 0:00 \_ ps xf the "tty" command called in a shell, then calling mc and running "tty" in his shell show these different ttys as well. -- cu jth _______________________________________________ mc mailing list https://mail.gnome.org/mailman/listinfo/mc