LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-28-2008, 06:29 PM   #1
twelvenine
Member
 
Registered: Sep 2006
Posts: 72

Rep: Reputation: 16
find out how many shells deep you are


i kind of remember a shell variable or a command that would tell you how many shells deep you are. so if i did like bash, bash, sh, bash, csh, i would be like 5 shells deep. whats the shell variable that keeps track of this?
 
Old 10-28-2008, 06:37 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Is SHLVL what you are looking for?

It is one of the variables that are listed when you run the env command.

Hope this helps.
 
Old 10-28-2008, 06:39 PM   #3
ophirg
Member
 
Registered: Jan 2008
Location: Israel
Distribution: Kubuntu 13.10
Posts: 134

Rep: Reputation: 34
try "ps" and count the number of shells in the list
or something like:
ps | grep "sh$" | wc -l
 
Old 10-28-2008, 06:42 PM   #4
twelvenine
Member
 
Registered: Sep 2006
Posts: 72

Original Poster
Rep: Reputation: 16
yeah SHLVL is what i was thinking of. thanks
 
Old 10-28-2008, 06:54 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by twelvenine View Post
yeah SHLVL is what i was thinking of. thanks
You might want to integrate it in your prompt so you can see it easily.
 
  


Reply


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
Deep Freeze-Like? H0SSAM Linux - Software 1 03-17-2006 04:10 PM
deep desire shukla_chanchal LQ Suggestions & Feedback 25 11-22-2005 06:51 PM
the deep freeze nlang Linux - Networking 0 11-20-2003 02:57 PM
Deep Water portfox Linux - Networking 4 10-30-2003 08:53 PM
In a deep sleep frkstein Linux - General 2 03-11-2003 09:09 AM


All times are GMT -5. The time now is 08:57 AM.

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