Re: [gentoo-user] Test for X from cli

2006-08-01 Thread Daniel Iliev
John J. Foster wrote: > Good afternoon, > > In a bash script, how can I test whether the script itself is being > run from a virtual terminal, or from an emulator like konsole within X? > > Thanks, > festus Hello, Here is yet another approach. So I would use the command "tty". [EMAIL

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread Donnie Berkholz
John J. Foster wrote: On Tue, Aug 01, 2006 at 03:43:12PM -0400, Philip Webb wrote: 060801 John J. Foster wrote: In a bash script, how can I test whether the script itself is being run from a virtual terminal, or from an emulator like konsole within X? 'echo $DISPLAY' returns ':0' from Konsole,

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread John J. Foster
On Tue, Aug 01, 2006 at 11:37:17PM +0400, dg wrote: > On Tuesday 01 August 2006 23:20, John J. Foster wrote: > > One possible solution would be to check the value of $TERM variable... If it > is 'xterm' then you're probably in the X terminal emulator. "probably" is not good ;-) -- Ambition is a

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread dg
On Tuesday 01 August 2006 23:20, John J. Foster wrote: > Good afternoon, > > In a bash script, how can I test whether the script itself is being > run from a virtual terminal, or from an emulator like konsole within X? > > Thanks, > festus Hi, One possible solution would be to check the value of

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread John J. Foster
On Tue, Aug 01, 2006 at 03:43:12PM -0400, Philip Webb wrote: > 060801 John J. Foster wrote: > > In a bash script, how can I test whether the script itself is being run > > from a virtual terminal, or from an emulator like konsole within X? > > 'echo $DISPLAY' returns ':0' from Konsole, > but nothi

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread Jesús Guerrero
El Martes, 1 de Agosto de 2006 21:20, John J. Foster escribió: > Good afternoon, > > In a bash script, how can I test whether the script itself is being > run from a virtual terminal, or from an emulator like konsole within X? > > Thanks, > festus If you need more concrete info, $TERM is also your

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread Alex Schuster
John writes: > In a bash script, how can I test whether the script itself is being > run from a virtual terminal, or from an emulator like konsole within X? You can check the existance of the DISPLAY environment variable: if [[ $DISPLAY ]] then echo "We're running under X" else e

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread Philip Webb
060801 John J. Foster wrote: > In a bash script, how can I test whether the script itself is being run > from a virtual terminal, or from an emulator like konsole within X? 'echo $DISPLAY' returns ':0' from Konsole, but nothing from a raw terminal called up via Ctl-Alt-F2 . -- =

Re: [gentoo-user] Test for X from cli

2006-08-01 Thread Uwe Thiem
On 01 August 2006 20:20, John J. Foster wrote: > Good afternoon, > > In a bash script, how can I test whether the script itself is being > run from a virtual terminal, or from an emulator like konsole within X? See this script by the name "strangename": #! /bin/sh ps ax | grep strangename If r

[gentoo-user] Test for X from cli

2006-08-01 Thread John J. Foster
Good afternoon, In a bash script, how can I test whether the script itself is being run from a virtual terminal, or from an emulator like konsole within X? Thanks, festus -- Ambition is a poor excuse for not having enough sense to be lazy. pgpGfTreHkh94.pgp Description: PGP signature