Forgot your password?
typodupeerror

Comment Re:Default shells (Score 1) 118

(...) Bash is the default shell for most unix systems (...)

Phew - that heavily depends on what is meant with default shell and most unix systems.

What is a default shell for a given system?

One one hand you can specify default shell as the login shell that will be used when creating a new user account with the system defaults. For that can be changed individually by each system administrator, your above question can only be answered by asking all of the sysadmins =:-)

On the other hand you could say that the default shell is that interpreter that will be used by most of the system scripts of an given system. In that case I'd tend to say it's the Bourne Shell sh(1) for AT&T based systems, the C-Shell csh(1) for BSD based systems and the Bourne Again SHell bash(1) for Linux systems. Someone posted, that on AIX systems the Korn Shell ksh(1) is being used. I cannot verify that for I have no access to an AIX system right now.

What is meant by most unix systems?

If you count each machine running a UNIX or UNIX-like Operating System it's difficult to say for noone knows exactly how much Linux installations are really out there. If they outnumber all other UNIX machines bash(1) would be the winner, otherwise sh(1).

When you're only counting UNIX and UNIX-like Operating Systems I'd tend to say that most of them are AT&T based and so that the winner would be sh(1).

About shells

For I saw many posters mixing up things:

The Bourne Shell sh(1) (written by S. R. Bourne at the Bell Labs) is still the standard shell on most AT&T based UNIX implementations. A main reason is that almost all of the system scripts are written in sh(1) syntax.

The C-Shell csh(1) was introduced when the University of Berkeley (UCB) released their Berkeley System Distribution (BSD-UNIX) and therefore became very popular by it's users. The biggest tradeoff with csh(1) as a standard shell is the missing compatibility with sh(1) for its syntax supposed to be C-like (I never could agree with that - but this is just my point of view). Although you can specify the command interpreter with #! <interpreter> you still cannot overcome some problems (for example try to source a csh(1) script from within a sh(1) script). Nevertheless - when adding user accounts on BSD-based machines you'll often end up with the csh(1) as the default login shell.

bash(1) (the Bourne again shell) was written as part of the GNU project to implement an own free UNIX system. It's syntax is meant to be compatible with sh(1). On most Linux distributions /bin/bash is linked to /bin/sh. One of the major reasons so many people prefer bash(1) over sh(1) is that they added a command line history and command line editing beyond the erase/retype art.

Similary tcsh(1) is an extension to the csh interpreter with command line editing features.

I think I don't have anything to say about the Korn Shell ksh(1) for the master himself has already spoken.

FLAMING ISSUES

Discussing what may be the best shell is somewhat like discussing what someone prefers having for breakfast. Just do it the UNIX way: call exec and use whatever you prefer.

If you want to write scripts for being executed on different machines make a) sure your script starts with #! interpreter> and interpreter is a well known standard.

Cheers,

Klaus
--
My uncertainty principle:

Slashdot Top Deals

Term, holidays, term, holidays, till we leave school, and then work, work, work till we die. -- C.S. Lewis

Working...