Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which shell? 2

Status
Not open for further replies.

kasparov

Programmer
Feb 13, 2002
203
GB
Is there a straightforward way to find out which shell I'm running?

On my machine I have to log in as Bourne & then change to ksh (don't ask ...) & it would be nice to be able to run a simple command to check I'm running the right shell.

$SHELL won't tell me, I could run ps -f & process the output to find which is the parent & which is the child but I wondered if there's something tidier than this.

Thanks, Chris
 
I know what I do on AIX 4.3 : env|grep SHELL|cut -c7-
HTH ;-) Dickie Bird
db@dickiebird.freeserve.co.uk
 
Thanks DB but unfortunately doesn't work on Solaris.

I wonder if I can persuade the powers that be to change machines so I can tell which shell I'm running ... :)
 
enter ps (no options) the last entry is your shell vox clamantis in deserto.
 
echo $0 vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
jamisar:

$ ps
PID TTY TIME CMD
26766 pts/4 0:01 bash

$ ksh
$ ps
PID TTY TIME CMD
5111 pts/4 0:00 ksh
26766 pts/4 0:01 bash
vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
with resepct to dickiebird, his suggestion of
env|grep SHELL|cut -c7-

does work on a Solaris box, but you may have to change which columns you are 'cut'ting - ie on mine :
env |grep SHELL | cut -d '=' -f2


though obviousy echo $0 is quicker !
 
and, of course

echo $SHELL Mike
________________________________________________________________

&quot;Experience is the comb that Nature gives us, after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
$ echo $SHELL
/usr/local/bin/bash
$ ksh
$ echo $SHELL
/usr/local/bin/bash
vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top