TuskenTower on 22 Jan 2009 13:09:41 -0800 |
Eric, Walt's presentation on one-liners was sweet. The line you sent me choke on Slowaris. :( Amul On Thu, Jan 22, 2009 at 4:05 PM, Eric <eric@lucii.org> wrote: > 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 > ___________________________________________________________________________ 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
|
|