nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Find the nested Shell level?

This is a discussion on Find the nested Shell level? within the Shell scripting forums, part of the Development/Scripting category; Hello, Could someone let me know how do I find out what level of shell am I into? I use ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 04-21-2008, 12:51 PM
Junior Member
User
 
Join Date: Apr 2008
My distro: RedHat
Posts: 2
Rep Power: 0
hemcreddy is on a distinguished road
Default Find the nested Shell level?

Hello,

Could someone let me know how do I find out what level of shell am I into? I use to switch between one shell to other frequently in my Linux session but I forgot what level I'm in. Entering the "exit" command sometimes leaves the session sometimes takes me to the previously running shell.


Thanks,
Hem
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-21-2008, 03:17 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Use SHLVL variable under bash - it incremented by one each time an instance of bash is started.
Code:
echo $SHLVL
1
Code:
bash
echo $SHLVL
2
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 04-22-2008, 10:59 AM
Junior Member
User
 
Join Date: Apr 2008
My distro: RedHat
Posts: 2
Rep Power: 0
hemcreddy is on a distinguished road
Default

Thanks for your reply but this does not work on KSH. Any idea what is its equivalent in KSH.

Regards,
Hem
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
find subdomains in url nvbhole Shell scripting 2 12-22-2007 01:12 PM
writing a shell script to find out my shell name jaymob123 Shell scripting 1 10-08-2007 01:36 AM
find out what chip nic Linux software 1 01-30-2006 05:06 PM
linux changing run level Linux software 1 01-10-2006 07:25 PM
Different Level of graph rafiq380 Linux software 1 12-23-2005 06:33 PM


All times are GMT +5.5. The time now is 03:11 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36