How do you know what your current shell is? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How do you know what your current shell is?

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-13-2003
shad0w75 shad0w75 is offline
Registered User
 
Join Date: Jun 2003
Last Activity: 28 July 2003, 3:58 PM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question How do you know what your current shell is?

How do you know what shell you're in? I'm not looking for my login shell, but the one that i'm in currently.


Example:

bash-2.03$ csh
aries% ksh
$

What indicates that i'm in the c shell or the korn shell?
Sponsored Links
    #2  
Old 06-13-2003
google's Avatar
google google is offline Forum Advisor  
Advisor
 
Join Date: Jul 2002
Last Activity: 17 June 2009, 5:17 PM EDT
Location: Atlanta
Posts: 740
Thanks: 0
Thanked 2 Times in 2 Posts
at your shell prompt type echo $SHELL or take a look at your passwd entry in /etc/passwd to see what your default shell is.
Sponsored Links
    #3  
Old 06-13-2003
shad0w75 shad0w75 is offline
Registered User
 
Join Date: Jun 2003
Last Activity: 28 July 2003, 3:58 PM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
How do you know what your current shell is?

hmm... I must not be asking my question correctly.. sorry... newbie.

I start out in a bash shell, I change to the korn shell... what tells me that i've changed shells? Can you tell by the prompt?
    #4  
Old 06-13-2003
Mr_Proper Mr_Proper is offline
Registered User
 
Join Date: Jun 2003
Last Activity: 28 March 2004, 6:12 PM EST
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Bourne-type shells (that includes bash and ksh) have a $ in front of them. The C shell uses a %, and I think tcsh uses a >.

If you're a super-user or root, you're going to have a hash mark (#) in front no matter what.

You can grep the /etc/passwd file with your username to find out what shell starts up on default (it's the last field), but I'm not sure if there is a command or variable that tells the active shell.
Sponsored Links
    #5  
Old 06-13-2003
google's Avatar
google google is offline Forum Advisor  
Advisor
 
Join Date: Jul 2002
Last Activity: 17 June 2009, 5:17 PM EDT
Location: Atlanta
Posts: 740
Thanks: 0
Thanked 2 Times in 2 Posts
I think you asked correctly, I missunderstood. I wouldnt go by the shell prompt since you can easily change that (though it may have historical significance as to the shell it represents) Here is a way to get what your after...using the PID from the shell that your in see who the owner of that process is.

echo $$ # Gives the Parent Process ID
ps -ef | grep $$ | awk '{print $8}' #use the PID to see what the process is.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do I know my current shell ynixon UNIX for Dummies Questions & Answers 3 07-02-2008 04:32 PM
How to run a new shell with copy of current shell declarations? alex_5161 Shell Programming and Scripting 9 06-02-2008 02:48 AM
How do i execute script in the current shell Naresh Kumar Shell Programming and Scripting 5 06-12-2006 12:55 PM
Command to findout the current shell? Aceform UNIX for Dummies Questions & Answers 5 09-07-2005 01:00 PM
current shell mkan Shell Programming and Scripting 3 02-21-2005 07:20 AM



All times are GMT -4. The time now is 08:25 AM.