Help answer threads with 0 replies.
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 11-16-2010, 07:35 AM   #1
LQ Newbie
Registered: Jun 2010
Location: Johannesburg, South Africa
Posts: 1

Rep: Reputation: 0
Differences between shells ?

What are the differences between the shells in Linux (eg. bash,bourne,korn,C etc) and which one is it better to run scripts under?
Old 11-16-2010, 07:38 AM   #2
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Hello, welcome to LQ!

Above link probably should be high on your reading list.

As for "which is better", there is no single absolutely correct answer. Different systems (OS's) have different shells, many have multiple shells on them; some are more common than others, and some are definitely more rare.

If you have a more specific question, by all means, ask it.
Old 11-16-2010, 09:06 AM   #3
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,603
Blog Entries: 25

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981

I would add that the choice of shell can be a personal preference and application development for tasks. You can write a script to perform required or desired repeated tasks.

Bash (Unix shell)
, a Unix command shell written for the GNU project seems to be the default for most users.
excerpt from Bash (Unix shell);Bash is a POSIX shell with a number of extensions. It is the shell for the GNU operating systemUnix-like operating systems. It is the default shell on most systems built on top of the Linux kernel as well as on Mac OS X and Darwin. It has also been ported to Microsoft Windows using Subsystem for UNIX-based Applications (SUA), or POSIX emulation provided by Cygwin and MSYS. It has been ported to MS-DOS by the DJGPP project and to Novell NetWare.
The Bash command syntax is a superset of the Bourne shell command syntax. The vast majority of Bourne shell scripts can be executed by Bash without modification, with the exception of Bourne shell scripts stumbling into fringe syntax behavior interpreted differently in Bash or attempting to run a system command matching a newer bash builtin, etc. Bash command syntax includes ideas drawn from the Korn shell (ksh) and the C shell (csh) such as command line editing, command history ...
Bash Reference Manual is a great manual to have on hand.

Bash Beginners Guide will provide some useful information.

Advanced Bash-Scripting Guide 6.1
is revised and this document is both a tutorial and a reference on shell scripting with Bash by Mendel Cooper.

The above links and others can be found at 'Slackware-Links'. More than just Slackware® links!
1 members found this post helpful.
Old 11-16-2010, 09:47 AM   #4
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
There's enough info on the net. "Better" is on the eye of the beholder, of course. The only thing I can say for sure is that if you need supreme portability then you probably should stick to the Bourne Shell (sh). Bash is a very good compromise between portability and features.

There's a lot of alternatives that offer good feature sets (ksh), or just an alternate syntax (csh variants).

A good place to start is the wikipedia.
Old 11-16-2010, 09:35 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
You may wish to read this
In general, bash is the default on Linux, whilst ksh tends to be the default on commercial *nix eg Solaris.
These are both 'modern' shells ie have a lot of built-in funcionality.
This is for non-root users; root shell tends to be called 'sh', which can actually be the old Bourne shell or the POSIX shell.
Bash is highly compatible with ksh; just watch out for differences in gnu versions of utilites eg 'find'.
I highly recommend specifying the full shell path+name at the start of every shell script file to avoid nasty surprises. You cannot assume that even the same named shell will be stored in the same path on different *nixes.
In some instances (eg read the startup rules for logging in in different circumstances) a shell may be symlinked to another shell....


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
[SOLVED] Can all shells read all environmental variables set by other shells? carlodelmundo Linux - Newbie 2 07-23-2010 03:03 PM
shells? sycamorex Linux - Software 3 11-14-2008 02:15 AM
help on the different shells... JoannesX Programming 2 02-06-2005 12:07 PM
do I need all the shells? helpme0904 Fedora 6 10-01-2004 03:03 PM
Why so many shells? linuxzouk Linux - Newbie 5 06-10-2004 08:36 AM

All times are GMT -5. The time now is 06:42 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