The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

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

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-13-2003
Registered User
 

Join Date: Jun 2003
Posts: 3
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?
Forum Sponsor
  #2  
Old 06-13-2003
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
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.
  #3  
Old 06-13-2003
Registered User
 

Join Date: Jun 2003
Posts: 3
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
Registered User
 

Join Date: Jun 2003
Posts: 6
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.
  #5  
Old 06-13-2003
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
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.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0