Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-14-2004, 04:43 PM   #1
LQ Newbie
Registered: Jul 2003
Posts: 27

Rep: Reputation: 15
How to know what is the current (not initial) shell?

How to know what is the current (not initial) shell?
Old 09-14-2004, 04:45 PM   #2
Registered: Apr 2003
Location: Buenos Aires, Argentina
Distribution: Slackware, Gentoo
Posts: 397

Rep: Reputation: 30
cat $SHELL
Old 09-14-2004, 06:10 PM   #3
LQ Newbie
Registered: Jul 2003
Posts: 27

Original Poster
Rep: Reputation: 15
it shows an initial shell. If you logged in with csh and then typed 'bash' how to see that bash is the actual current shell?
Old 09-14-2004, 08:09 PM   #4
Registered: Aug 2004
Location: Davis, California
Distribution: Gentoo, always Gentoo.
Posts: 159

Rep: Reputation: 30
Do you mean programatically or just for your own knowledge?

Try typing 'ps'. It should show you both the original and current shell running.

If you start with bash the $BASH or $shell variables might contain your current shell.

Last edited by dsegel; 09-14-2004 at 08:11 PM.
Old 09-15-2004, 03:37 AM   #5
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 63
I did not test, but if your write a shell script, it can get the PID of the parent process (the shell). Then in Linux, you can go and see where /proc/<pid>/exe is pointing to.

Old 09-15-2004, 02:17 PM   #6
Registered: Aug 2003
Distribution: Arch Linux 0.7
Posts: 81

Rep: Reputation: 15
echo $SHELL should "allways" show the current shell, if set up correctly that is...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with X consoles - "shell-init: error retrieving current directory" lowpro2k3 Slackware 4 03-26-2007 07:36 PM
Determining current shell subu_s Programming 11 01-04-2005 08:10 AM
how can I change the current shell on the fly? Xavius Linux - Newbie 5 04-06-2004 09:00 AM
Finding information about the current shell atirya_yodha Linux - Newbie 3 03-18-2004 02:30 PM
current Slack-Current giving troubles? r_jensen11 Slackware 5 02-02-2004 06:08 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration