Shell type, version and selection
Anyone who uses *inx, whether as a loginThe shell is also programmed to touch the shell.
After years ofDevelopment, a wide variety of shells. In addition to our familiar sh, ksh, CSH, bash ... , there are various free or commercial versions such as RC, ES, Eshell, PSH, Zoidberg and so on. A lot of kinds, there are standardized requirements, this is the origin of POSIX.
In fact, is the common Shell, but also the function of different styles. In general, people tend to hoardPlatform, using the default shell, also known as/bin/sh. However, the differentThe system's shell is different from name to path. Because the first shell was the Bourne shell, the Sh on UNIX was the Bourne shell. But now it's a bit confusing, like the HP-UX 11i has become POSIX sh. The following is a list of common shells on a platform.
SHELL Solaris 9 HP-UX 11iAIX 5.3 SCO 7.14 LINUX (RedHat)
----- --------- --------- ------- -------- --------------
bsh/usr/bin/sh N/A/usr/bin/bsh/usr/bin/sh/bin/ash (BSH, Ash)
CSH/USR/BIN/CSH/USR/BIN/CSH/USR/BIN/CSH/USR/BIN/CSH/BIN/CSH-Tcsh
TCSH/USR/BIN/TCSH N/A N/a/bin/tcsh
ksh88/usr/bin/ksh/usr/bin/ksh/usr/bin/ksh/usr/bin/ksh88 N/A
Ksh93/usr/dt/bin/dtksh Dtksh/usr/bin/ksh93/usr/bin/ksh N/A
Bash/usr/bin/bash N/A N/a/bin/bash
Pdksh N/a N/a n/a/bin/ksh
POSIXSH/USR/XPG4/BIN/SH/BIN/SH/USR/BIN/PSH/U95/BIN/SH/BIN/SH (Bash)
Zsh/usr/bin/zsh N/A N/a/bin/zsh
It is important to understand the different shells and versions, especially when porting programs between different platforms. I have helped a friend write a script with ksh93, the result he can not execute in SCO 5.0.5, originally he is ksh88, do not support + + operator.
1. Login Shell for root user
The login shell of the root user should use the static connection (statically linked) version of the shell,
such as/sbin/sh (Solaris, HP-UX, SCO),/sbin/sash (RedHat Linux)
In case the share library is lost or the partition is not mount, the root user can login.
2. The shell used to write script, from portability and universality, is recommended for Ksh.
Because POSIX 1003.2 is modelled on Ksh. And bash is written in compliance with POSIX. But bash exceptLinux outside,Less application. Also, some of the features in ksh93 are not in bash, such as associative arrays.
3. Login shell for the general user, refer to the shell scripts in pages of Russell Quong:
Overall Evaluation
Shell Interactive Scripting
SH c-b
Ksh B + A-
Bash a A
CSH B + C
TCSH A c+
Zsh A-(?) A (?)
Rc/es A-(?) A (?)
For personal reasons, Russell a preference for bash. In fact, zsh should be a+,a+. Zsh is basically ksh, bash, csh superset, very powerful. Recommended for use. Go here http://www.zsh.org/can learn more about zsh. Unfortunately, not many people use it now.
But with so many shells, one thing I'm not satisfied with is the lack ofembedded awk and Regex functions. PSH (Perl Shell) is an example of a remedy, but not a real shell after all. Ben wanted to write a, look at the Bash 3.0 source code, there are 300,000 lines, had to do.
For SH, csh there is no good way, because of historical reasons, generally no version information, unless you look at source code.
Go here http://www.in-ulm.de/~mascheck/bourne/to see the respective platform Sh.
Shell type, version and selection