From owner-freebsd-questions Mon Aug 21 15:36:38 2000 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (zoom3-002.telepath.com [216.14.3.2]) by hub.freebsd.org (Postfix) with SMTP id E355D37B636 for ; Mon, 21 Aug 2000 15:36:33 -0700 (PDT) Received: (qmail 56128 invoked by uid 100); 21 Aug 2000 22:35:55 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14753.44747.906899.853494@guru.mired.org> Date: Mon, 21 Aug 2000 17:35:55 -0500 (CDT) To: Alfred Perlstein Cc: questions@freebsd.org Subject: Re: Is it possible to discriminate between shell used in CLI and XWindowmode ? In-Reply-To: <111165061@toto.iv> X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Alfred Perlstein writes: > * Ariel Burbaickij [000820 08:38] wrote: > > Concrete: I want to leave csh as root shell on the console and work as > > root with bash in X Window is it somehow managable ? > Figure out how to test if the DISPLAY variable is set in your enviornment, > if it is then try to exec bash. That's one way. You could also check TERM, which will be different in those two environments. Personally, I'd check the tty you are on: if (`tty` =~ /dev/ttyp*) then exec bash endif Of course, all three of these tests give different behavior if you're on something other than the console or an x terminal emulator of some kind.