UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 22nd, 2003, 04:57 PM
vslewis vslewis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Phoenix
Posts: 5 vslewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 44 sec
Reputation Power: 0
Exclamation diff shells

Is there any way to programmatically determine what shell (sh, ksh csh,...) you are in?

Reply With Quote
  #2  
Old December 22nd, 2003, 05:02 PM
druuna druuna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 137 druuna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 37 sec
Reputation Power: 0
echo $SHELL

Reply With Quote
  #3  
Old December 23rd, 2003, 01:08 PM
vslewis vslewis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Phoenix
Posts: 5 vslewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 44 sec
Reputation Power: 0
$SHELL is initialized ( in our system!) only in the login script; i.e. it does not change if when you switch shells. Thus I need someway to tell what shell I am in. And, although this seems odd I do not want to manipulate any variables manually.

Reply With Quote
  #4  
Old December 23rd, 2003, 01:28 PM
druuna druuna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 137 druuna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 37 sec
Reputation Power: 0
I don't know of any command that will tell you that

Only way that I know of, besides the $SHELL that you can't use, is to be a bit creatif and write a script.

Reply With Quote
  #5  
Old December 23rd, 2003, 08:19 PM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 285 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 3 h 6 m 53 sec
Reputation Power: 6
Nobody has said it up to now but ...

There is something very wrong with the way you are
doing/thinking about shell scripts if you need to know
programatically what shell you are in. Sounds like you
wish to use shell features which are not available or
differ in the various shells.

Bad idea! If you want portable shell scripts you should
be using the POSIX shell or ksh88.

- Finnbarr

Reply With Quote
  #6  
Old December 23rd, 2003, 09:47 PM
jayakhanna jayakhanna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: India
Posts: 61 jayakhanna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
ps | grep `echo $$` | awk '{ print $4 }'

This will tell you the current shell in which you are working

ps will show all the processes, including the shells which are opened, echo $$ will give the current shells process id and then we can grep and print it using awk.
__________________
Regards
JK

Last edited by jayakhanna : December 23rd, 2003 at 09:51 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > diff shells


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT