|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: [PLUG] What is my current shell?
|
Try this:
ps a | grep "^ *$$" | grep -v grep | awk '{print $5}'
It reported bash, sh and ksh just fine but reported tcsh as -csh for
some strange reason.
Still, it's better than $SHELL in all but one case.
Walt inspired me to try a perl one-liner... but my first attempts have
failed. Still trying :-)
HTH
Eric
TuskenTower wrote:
> All,
> We have an oddball problem. Is there any portable way to determine
> what shell you are using once you are inside a script?
>
> Right now, we are thinking of using
> which `echo $0`
>
> As you can see here, $SHELL does not change when you switch shells.
> [2:07pm] [shaha:pts/8] [shaha] : /gtc/staff/shaha/work/sortT > echo $SHELL
> /usr/local/bin/tcsh
> [2:08pm] [shaha:pts/8] [shaha] : /gtc/staff/shaha/work/sortT > bash
> shaha@shaha:~/work/sortT$ echo $SHELL
> /usr/local/bin/tcsh
>
> This is for problems at customer sites where they are using the wrong
> Bourne shell on Solaris (/bin/sh) when we want them to use
> /usr/xpg4/bin/sh.
>
> thanks,
> Amul
> ___________________________________________________________________________
> Philadelphia Linux Users Group -- http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
>
>
--
# Eric Lucas
#
# "Oh, I have slipped the surly bond of earth
# And danced the skies on laughter-silvered wings...
# -- John Gillespie Magee Jr
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|