Re: How to know when mc is running in a terminal

Thanks frank. The answer was in front of my nose the whole time.

Environment variable MC_TMPDIR can be used to know that you're being
called from mc. For some reason MC_SID disappears but MC_TMPDIR does

I needed something more specific than just knowing whether I'm
in pts or not. I want to know if it's mc's F4 EDIT command calling, or
at least being called from a terminal with mc running in it.

if [ -n "$DISPLAY" -a -n "$MC_TMPDIR" ]; then
    # we're being called from mc in XWindow terminal

On Mon, 10 Nov 2014 02:06:26 -0800, frank <y199mp1505 gmail com> wrote:

On 10/11/2014 01:25, Mike Smithson wrote:
how can a script know whether it is being
called from F4 in mc or just a terminal?

Try the shell command 'tty'. In the Linux console it will reply e.g. /dev/tty1. In a graphic terminal the reply will be /dev/pts/0.

Peace and Cheer

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