If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How do I find the name of the current shell?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-27-03, 23:51
mulla mulla is offline
Registered User
 
Join Date: Oct 2003
Posts: 4
How do I find the name of the current shell?

Hello,
How to find the name of the current shell that I am working on(Whether it is csh or ksh or bsh)? Are there any specific commands to find out?
I did a search, but could not find any useful links.

I did "echo $SHELL", but this always ouputs "/sbin/sh" irrespective of which shell I am using.

Can anyone help on this?

Regards,
Murali.
Reply With Quote
  #2 (permalink)  
Old 10-28-03, 07:11
hacker hacker is offline
Registered User
 
Join Date: Oct 2003
Posts: 18
Re: How do I find the name of the current shell?

SHELL always contain the login shell, if not explicitly set to another value.

Why do you need to find out the shell? You always have '#!/bin/sh' (or similar) at the top of shell scripts, so in those cases the shell is known.

/Hacker
Reply With Quote
  #3 (permalink)  
Old 10-28-03, 07:33
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Re: How do I find the name of the current shell?

Quote:
Originally posted by mulla
Hello,
How to find the name of the current shell that I am working on(Whether it is csh or ksh or bsh)? Are there any specific commands to find out?
I did a search, but could not find any useful links.

I did "echo $SHELL", but this always ouputs "/sbin/sh" irrespective of which shell I am using.

Can anyone help on this?

Regards,
Murali.
Hi Murali,

Another form, from prompt, execute echo $0 or ps.

Gustavo.
Reply With Quote
  #4 (permalink)  
Old 10-28-03, 09:37
mulla mulla is offline
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks Gustavo,
$0 will do.
Reply With Quote
  #5 (permalink)  
Old 10-28-03, 23:41
karthi_tvr karthi_tvr is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 12
echo $0 works for bourne and korn shell. It is best to use "ps" and find the latest shell forked.
__________________
Thanks and Regards
Karthik R
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On