[SunHELP] Shell Problem

Jeff Howie sunhelp at sunhelp.org
Mon Apr 16 20:33:09 CDT 2001


You could also use the SHELL variable if set by that time.

case $SHELL in
  bash)
  ksh)
  csh)
esac

Or the '0' variable might be set to a usable value, depending on the OS:

case $0 in
  -ksh)
  -bash)
  -csh)
  -su)
esac

These should send you off on a half-decent tangent ... ;*>

Ravi Katti wrote:
> I think just by executing ps command you will get to know the shell used
> currently by the user. Also you may try finger username|grep -i shell. Also
> the syntax of bourne shell is understood by most of the other shells.
> 
> ----Original Message Follows----
> From: Naresh Narang <nareshnarang at 123india.com>
> Reply-To: sunhelp at sunhelp.org
> To: sunhelp at sunhelp.org
> Subject: [SunHELP] Shell Problem
> Date: 16 Apr 2001 17:23:31 -0700
> 
>    I want to set up env. variables based upon the shell a user is running,
> so in order to find what shell a user is using, I have to run a script in a
> Shell say /bin/sh. If I run it using #!/bin/sh to find user's shell, every
> shell behaves differently or if I use other methods to find shell then how
> do I use that shell to set env variable that can be read by user's shell and
> other statements are ignored.
> 
> Basically I want a general script that can set env variables based on user's
> shell syntex.

-- 
THKS :&) Jeff Howie



More information about the SunHELP mailing list