LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 04-28-2006, 01:47 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
which shell i use??


Hi because i am using lot of different pcs i want to find out every time what shell the system use... Is there anyc ommand for that?
 
Old 04-28-2006, 02:01 AM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Normally, "echo $SHELL" will tell you what shell is being used - eg /bin/bash, /bin/tcsh, /bin/zsh or whatever.

--Ian
 
Old 04-28-2006, 02:27 AM   #3
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
it's also contained in /etc/passwd if you need a quick way to view alot of users shells (i use it to check daemon/nobody accounts etc. have no shell.
 
Old 04-28-2006, 05:11 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Code:
echo $0
will give you the current shell
 
Old 04-28-2006, 05:27 AM   #5
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Be carefull with $0.

echo $0 gives you the name of the shell script you're running.
It only gives you the name of your shell if you type it at the command line of the shell itself.
 
Old 04-28-2006, 05:33 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Yes not from within a script, from a console
 
Old 04-28-2006, 06:39 AM   #7
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Yes If you have some experience with DOS,it is exactly like %0
 
Old 04-28-2006, 08:15 AM   #8
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
I thought we were talking of real shells only, not toys

How do you do it?

Code:
H:\>echo %0
%0
What could be results?

Just interested...
 
Old 04-29-2006, 01:15 AM   #9
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
echo %0 will not give you any name in DOS as there is only one type of DOS(cmd.exe is only command.com upgraded).

When you run it from within a batch file,it will return the name of the batch file without an extension.

Example:

Save this in demo.bat



Code:
echo %0
It will give the output "demo"(without quotes)

Last edited by gregorian; 04-29-2006 at 01:17 AM.
 
  


Reply



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
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
I made a shortcut to a shell script and it is using default shell icon... shlinux Linux - Software 2 04-20-2006 06:29 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:35 PM.

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
Open Source Consulting | Domain Registration