Unix Shell - how to find which shell I am using currently

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > October 2006 > how to find which shell I am using currently





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author how to find which shell I am using currently
senthilS

2006-10-30, 1:19 pm

I wanted to know if I can find the shell which I am using currently,
below is the method I tried out

$
$bash
bash-2.05$
bash-2.05$ echo $SHELL
/usr/bin/sh

bash-2.05$finger -m username

Login name: username In real life: Full Name
Directory: /home/username Shell: /bin/csh
On since Oct 25 16:28:23 on pts/2 from user.domain.com
3 minutes 52 seconds Idle Time

you can see that I changed my shell to bash but both the commands show
different shell environments?

What if I need to find which shell I am into now?
Thanks,

Loki Harfagr

2006-10-30, 1:19 pm

Le Mon, 30 Oct 2006 08:46:43 -0800, senthilS a écrit_:

> I wanted to know if I can find the shell which I am using currently,
> below is the method I tried out
>
> $
> $bash
> bash-2.05$
> bash-2.05$ echo $SHELL
> /usr/bin/sh
>
> bash-2.05$finger -m username
>
> Login name: username In real life: Full Name
> Directory: /home/username Shell: /bin/csh
> On since Oct 25 16:28:23 on pts/2 from user.domain.com
> 3 minutes 52 seconds Idle Time
>
> you can see that I changed my shell to bash but both the commands show
> different shell environments?
>
> What if I need to find which shell I am into now?



Try :
# echo $0
Robert Katz

2006-10-30, 1:19 pm

senthilS wrote:
> I wanted to know if I can find the shell which I am using currently,
> below is the method I tried out
>
> $
> $bash
> bash-2.05$
> bash-2.05$ echo $SHELL
> /usr/bin/sh
>
> bash-2.05$finger -m username
>
> Login name: username In real life: Full Name
> Directory: /home/username Shell: /bin/csh
> On since Oct 25 16:28:23 on pts/2 from user.domain.com
> 3 minutes 52 seconds Idle Time
>
> you can see that I changed my shell to bash but both the commands show
> different shell environments?
>
> What if I need to find which shell I am into now?
> Thanks,
>


ps -p "$$" -o comm=


--
Regards,

---Robert
bsh

2006-10-30, 7:30 pm

senthilS wrote:
> ...


Both "$0" and "ps" can be easily spoofed, and well as
needing to cater to portability concerns. In addition,
many shells will "advertise" themselves as another
shell ("bash" and "ksh" as "sh", etcetera) ostensibly
for configuring feature visibility yet obscuring the
controlling standard (SYS5, BSD, POSIX, ...).

For a non-trivial solution (listed in order of general
scope), see if any of the following fit your specific needs:

"shtype"
http://shelldorado.com/scripts/cmds/shtype.txt

"The Kameleon Shell.sh"
http://www.unixreview.com/documents/s=1344/ur0312e/

"whichshell"
http://groups.google.com/group/comp...1513a857080ed64

"which_interpreter"
http://stchaz.free.fr/

=Brian

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com