How to know if the terminal supports GUI

Hi,
I am using BASH and I define vi() function to start gvim GUI
program. This works great when I work on my Linux machine, but when I
log in remotely, it errors out saying "can not open display". I have
to un-define vi().

Is there a way I can know that I am working in a text mode in the
vi() to start vim in certain mode?

Thanks.
linq936 [ Sa, 03 November 2007 02:19 ] [ ID #1861403 ]

Re: How to know if the terminal supports GUI

In article <1194052742.504386.210650 [at] v23g2000prn.googlegroups.com>,
linq936 <linq936 [at] gmail.com> wrote:

> Hi,
> I am using BASH and I define vi() function to start gvim GUI
> program. This works great when I work on my Linux machine, but when I
> log in remotely, it errors out saying "can not open display". I have
> to un-define vi().
>
> Is there a way I can know that I am working in a text mode in the
> vi() to start vim in certain mode?
>
> Thanks.

Check whether the environment variable DISPLAY is defined.

--
Barry Margolin, barmar [at] alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Barry Margolin [ Sa, 03 November 2007 03:14 ] [ ID #1861404 ]

Re: How to know if the terminal supports GUI

On Nov 3, 7:14 am, Barry Margolin <bar... [at] alum.mit.edu> wrote:
> In article <1194052742.504386.210... [at] v23g2000prn.googlegroups.com>,
>
> linq936 <linq... [at] gmail.com> wrote:
> > Hi,
> > I am using BASH and I define vi() function to start gvim GUI
> > program. This works great when I work on my Linux machine, but when I
> > log in remotely, it errors out saying "can not open display". I have
> > to un-define vi().
>
> > Is there a way I can know that I am working in a text mode in the
> > vi() to start vim in certain mode?
>
> > Thanks.
>
> Check whether the environment variable DISPLAY is defined.
>
> --
> Barry Margolin, bar... [at] alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***

I think if you have xterm software then it should be supporting GUI

% which xterm
/usr/bin/xterm
ramesh.thangamani [ Mo, 05 November 2007 10:06 ] [ ID #1862383 ]

Re: How to know if the terminal supports GUI

In article <1194253565.458090.318920 [at] v29g2000prd.googlegroups.com>,
rthangam <ramesh.thangamani [at] gmail.com> wrote:

> On Nov 3, 7:14 am, Barry Margolin <bar... [at] alum.mit.edu> wrote:
> > In article <1194052742.504386.210... [at] v23g2000prn.googlegroups.com>,
> >
> > linq936 <linq... [at] gmail.com> wrote:
> > > Hi,
> > > I am using BASH and I define vi() function to start gvim GUI
> > > program. This works great when I work on my Linux machine, but when I
> > > log in remotely, it errors out saying "can not open display". I have
> > > to un-define vi().
> >
> > > Is there a way I can know that I am working in a text mode in the
> > > vi() to start vim in certain mode?
> >
> > > Thanks.
> >
> > Check whether the environment variable DISPLAY is defined.
> >
> > --
> > Barry Margolin, bar... [at] alum.mit.edu
> > Arlington, MA
> > *** PLEASE post questions in newsgroups, not directly to me ***
> > *** PLEASE don't copy me on replies, I'll read them in the group ***
>
> I think if you have xterm software then it should be supporting GUI
>
> % which xterm
> /usr/bin/xterm

If X you're not logged in through X windows, /usr/bin/xterm will still
be there, but the GUI is not available.

To the OP: how do you login remotely? If you use ssh with X windows
forwarding, vim should still work.

--
Barry Margolin, barmar [at] alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Barry Margolin [ Mo, 05 November 2007 11:53 ] [ ID #1862387 ]
Linux » comp.unix.shell » How to know if the terminal supports GUI

Vorheriges Thema: problems with changing date through shell script
Nächstes Thema: How to compare ASCII char with octal number