操作系统shell的比较/Comparison of command shells
操作系统shell的比较/Comparison of command shells
下面的比较能可以帮助大家对shell功能和分类有个大致的了解:
A command shell is a command line interface computer program to an operating system.
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL[2] | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usual environment | POSIX | POSIX | POSIX | POSIX | POSIX | POSIX | POSIX | POSIX | Win32 | Win32 | .NET | DOS | DOS | OS/2 | Plan 9,POSIX | Java | Python | Ruby | OpenVMS |
Introduced | 1987 | 1978 | 1979 | 1994 | 1982 | 1989 ? | 1990 | 1989 | 1993 | 1993 | 2006 | 1980 | 1989 | 1987 | 1989 | 2005 | 1991 | 1995 | 1977 ? |
Completion | Yes (extendable) | Yes (via the ESC key) | Yes (extendable) | No | Yes (extendable) | Yes | Yes (extendable) | No | Yes (partial) | Yes (partial) | Yes (extendable) | No | Yes | Yes | Yes[3] | Yes | Yes (provided by the rlcompleter module or IPython) | Yes | No |
Pipes | text concurrent | text concurrent | text concurrent | text | text (may contain serialized objects ifprint -C is used) concurrent | text concurrent | text concurrent | text concurrent | text concurrent | text | objects concurrent | text sequential temporary files | text sequential temporary files | text concurrent | text concurrent | not supported | objects (when using IPython+IPipe) | not supported | text (via PIPE command) |
Integer arithmetic | Yes (via $(( )), (( )) and let syntax) | Yes (via @ syntax) | Yes (via @ syntax) | Yes | Yes (via $(( )), (( )), let syntax and expr builtin) | Yes (via $(( )) syntax) | Yes (via $(( )), (( )) and let syntax) | Yes [4] | Yes (via "set /a") | Yes (via %@eval[ ] function) | Yes | No | Yes (via %@eval[ ] function) | No | No | Yes | Yes | Yes | Yes |
Typing discipline | dynamic weak | dynamic weak | dynamic weak | dynamic strong | dynamic weak | dynamic weak | dynamic weak | dynamic weak | dynamic weak | dynamic weak | dynamic or static strong | dynamic weak | dynamic weak | dynamic weak | ? | dynamic strong | dynamic strong | dynamic strong | dynamic weak |
Floating point arithmetic | No | No | No | Yes | Yes (including C99-style extensions) | No | Yes | No | No | Yes (via %@eval[ ] function) | Yes | No | Yes (via %@eval[ ] function) | No | No | Yes | Yes | Yes | No |
Date & time arithmetic | No | No | No | ? | No | No | No | No | No | Yes | Yes | No | Yes | No | No | Yes | Yes | Yes | Yes |
Scientific notation | No (except for printf %f/%g) | No | No | Yes | Yes (including C99-style base16 notation) | No | Yes | No | No | Yes[5] | Yes | No | No | No | No | Yes | Yes | Yes | No |
Binary prefix notation | No | No | No | Yes | No | No | No | No | No | ? | Yes | No | ? | No | No | ? | ? | ? | Yes |
Hash tables | Yes (via associative arrays) | No | No | Yes (via module) | Yes (via associative arrays) | No | Yes | No | No | No | Yes | No | No | No | No | Yes | Yes | Yes | No |
Compound Variables | No | No | No | Yes (via records or lists) | Yes | No | ? | No | No | No | Yes | No | No | ? | ? | ? | Yes (via tuples) | Yes | No |
Pattern Matching (regular expressionsbuilt-in) | Yes | No | Yes | Yes | Yes | No | Yes | No | Yes (via the findstr /rcommand) | Limited support | Yes (full regex support)[6] | No | No | No | No | Yes | Yes | Yes | No |
Pattern Matching (globbing) | Yes (*, ?, [...]) | Yes | Yes | Yes | Yes (*, ?, [...]) | Yes | Yes (*, ?, [...]) | Yes | Yes (*, ?) | Yes (*, ?, [...]) | Yes (*, ?, [...]) | Yes (*, ?) | Yes (*, ?, [...]) | Yes (*, ?) | Yes | ? | Yes | Yes (via Dir.glob() method) | Yes |
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL | |
Globbing qualifiers(filename generation based on file attributes) | No | No | No | No | No | No | Yes | No | ? | ? | ? | ? | ? | ? | No | ? | Yes (via glob module) | ? | No |
Recursive globbing(generating files from any level of subdirectories) | Yes (**/...) | No | No | No | Yes (with set -G, no following of symlinks) | No | Yes (**/... or***/... to follow symlinks) | No | No | Yes (via FOR /R) | ? | No | Yes (via FOR /R) | ? | No | ? | Yes (via glob module) | Yes (via Dir.glob() method) | Yes (via [SUBDIR...] ) |
Directory stack(pushd/popd) | Yes | Yes | Yes | No | No | ? | Yes | ? | Yes | Yes | Yes (all location types)[7] | No | Yes | ? | ? | ? | Yes (provided by IPython) | Yes (pass a block to Dir.chdir() method) | No |
Directory History Window(popup) | No | No | No | No | No | No | No | No | No | Yes | Yes | No | Yes | No | No | No | No | No | No |
Implicit Directory Change - If command is dir name changes to it | No complains command is dir | No | No | No | No | No | Yes via setopt AUTOCD | No | No | Yes | No | No | Yes | No | No | No | No | No | No |
Command history | Yes | Yes | Yes | No | Yes | Yes | Yes | No | Yes (F7) | Yes | Yes | No[8][9] | Yes | Yes | Yes[3] | Yes | Yes | Yes | Yes |
History completion | Yes | Yes | Yes | No | Yes | ? | Yes | No | Yes (F8) | Yes | Yes (F8) | No[8][9] | Yes | ? | Yes[3] | ? | Yes (provided by IPython) | Yes (with UtilityBelt gem) | No |
Spell checking | No | No | experimental | No | No | No | Yes | No | No | No | No | No | No | No | No | No | No | No | No |
Default user prompt[10] | bash-<version number>$ | % | > | > | $ | $ | <hostname>% | $ | <path>> | [<path>] | PS <path>> | <path or drive name>> | <path>> | [<path>] | term%, ; | bsh % | >>> | irb(main):001:0> | $ |
Custom command prompt | Yes (variable: $PS1) | Yes (variable: $prompt | Yes (variable: $prompt | No | Yes (variable: $PS1, and more) | Yes (variable: $PS1) | Yes (variable: $PS1, and more) | Yes (variable: $PS1) | Yes (environment variable: %PROMPT%) | Yes (environment variable: %PROMPT) | Yes (function: prompt) | Yes (environment variable: %PROMPT%) | Yes (environment variable: %PROMPT) | Yes (environment variable: %PROMPT%) | Yes (function: prompt, or variable: $prompt) | Yes (variable: bsh.prompt, or method: getBshPrompt()) | Yes (variable: sys.ps1) | Yes | Yes (SET PROMPT command) |
Exception handling | Yes (via trap) | ? | ? | ? | Yes (via trap) | ? | Yes | Yes (via trap) | No | No | Yes | No | No | No | Yes | Yes | Yes | Yes | Yes |
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL | |
One-dimensionalarray variables | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No | Yes | No | No | No | Yes | Yes | Yes | Yes | No |
Multi-dimensional array variables | No | No | No | Yes | Yes (both indexed and associative arrays) | No | Yes (via associative arrays) | No | No | No | Yes | No | No | No | Yes | Yes | Yes | Yes | No |
Array slicing | Yes (${var:offset:length} syntax) | No | No | No | Yes (${var:offset:length} and [${from}..${to}] syntax) | No | Yes (${var[from,to]} syntax) | No | No | No | Yes | No | No | No | Yes ($var(i j k)) | No | Yes | Yes | No |
Streamredirection | Yes (arbitrary fds) | Yes (stdin/out/err) | Yes (stdin/out/err) | Yes | Yes (arbitrary fds) | Yes (arbitrary fds) | Yes (arbitrary fds) | Yes (arbitrary fds) | Yes | Yes (stdin/out/err) | Yes | Yes (stdin/out only) | Yes (stdin/out/err) | Yes (stdin/out/err) | Yes | Yes | Yes | Yes | Yes (sys$input, sys$output assignment) |
Aliases | Yes | Yes | Yes | Yes (macro and procedure definitions) | Yes | Yes | Yes | Yes | Yes ("macros", viadoskey) | Yes | Yes | No | Yes | No | Yes (functions) | ? | Yes (functions) | Yes | Yes |
Search and replace on variables | Yes (via ${//} syntax) | No | Yes (via ${:s//} syntax | Yes (via string functions and regular expressions) | Yes (via ${//} syntax and builtin commands) | No | Yes (via ${:s//} and ${//} syntax) | No | Yes (via set %varname:expressionsyntax) | Yes (via %@replace[ ] function) | Yes (-replace operator) | No | Yes (via %@replace[ ] function) | No | No | ? | Yes (via string methods and regular expressions) | Yes (via string functions and regular expressions) | No |
Command substitution | Yes | Yes | Yes | ? | Yes | Yes | Yes | Yes | Yes (via FOR /F command) | Yes (via FOR /F command) | Yes | No | Yes (via FOR /F command) | No | Yes | ? | Yes | Yes | No |
Process substitution | Yes (if system supports /dev/fd/<n>or named pipes | No | No | ? | Yes (if system supports /dev/fd/<n> | No | Yes | No | No | ? | ? | No | ? | No | Yes (via: <{cmd} if system supports /dev/fd/<n>) | ? | Yes (via subprocess module) | Yes | No |
Quoting | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes (Backtick: `) | Yes | No | Yes (Backtick: `) | ? | Yes | ? | Yes | Yes | Yes |
Escaping | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Caret: ^) | Yes (Caret: ^) | Yes (Backtick: `) | No | Yes (Ctrl-X: ?) | Yes | Yes | Yes (Backslash: \) | Yes (Backslash: \) | Yes (Backslash: \) | Yes (quotes or string assignment) |
Parallel assignment | No | No | No | No | ? | ? | ? | No | No | No | Yes | No | No | No | ? | ? | Yes | Yes | No |
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL | |
Subshells | Yes | Yes | Yes | ? | Yes | Yes | Yes | Yes | Yes (Backtick: ` in for /f usebackq) | Limited, via %@execstr[ ] and %@exec[ ] | Yes | No | Limited, via %@execstr[ ] and %@exec[ ] | ? | Yes | ? | Yes | Yes (Backtick: `) | Yes (spawn) |
Job control | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | Yes | No | No | No | Handled byrio | ? | Yes | Yes | Yes |
Functions | Yes | No | No | Yes | Yes | Yes | Yes | Yes | Yes (via "call :label") | Yes | Yes | No | Yes | No | Yes | Yes | Yes | Yes | Yes |
Variadic functions | Yes | No | No | Yes | Yes | Yes | Yes | Yes | No | No | Yes | No | ? | No | Yes | No | Yes | Yes | No |
Default arguments | Yes | No | No | No | Yes | Yes | Yes | Yes | No | No | Yes | No | No | No | Yes | No | Yes | Yes | No |
Named parameters | No | No | No | No | Yes (for user-defined "types") | No | No | No | No | No | Yes | No | ? | No | ? | No | Yes | Yes | No |
Lambda functions | No | No | No | Yes | No | No | No | No | No | No | Yes | No | No | No | No | No | (lambdas can't have control structures) | Yes | No |
eval function | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | No | Yes | No | Yes | Yes | Yes | Yes | No |
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL | |
(De-)Serializationof composite datatypes | No | No | ? | No | Yes (print -v var, read -C var) | No | ? | No | No | No | Yes | No | No | No | ? | Yes | Yes | Yes | No |
Pseudorandom number generation | Yes ($RANDOM) | ? | ? | Yes (random-integer, random-real) | Yes ($RANDOM) | ? | Yes ($RANDOM) | ? | Yes (%random%) | Yes (%@random[ ] function) | Yes | No | Yes (%@random[ ] function) | No | No | Yes | Yes | Yes | No |
TCP/UDPconnections as streams | Yes (client only) | No | No | Yes | Yes (and SCTP support, client only) | No | Yes (client and server but only TCP) | No | No | No | Yes | No | No | No | No | Yes | Yes | Yes | Yes (server TCP only) |
Native CIM/WBEMsupport | No | No | No | No | No | No | No | No | No | No | Yes | No | No | No | No | ? | ? | ? | No |
Comments | Yes (#) | Yes (#) | Yes (#) | Yes (; and #| ... |# for multi-line comments) | Yes (#) | Yes (#) | Yes (#) | Yes (#) | Yes (rem and unofficially the invalid label ::) | Yes (rem and unofficially the invalid label ::) | Yes (#); and <# ... #> for multi-line comments | Yes (rem and unofficially the invalid label ::) | Yes (rem and unofficially the invalid label ::) | Yes (rem and unofficially the invalid label ::) | Yes (#) | Yes (//) | Yes (#) | Yes (#) | Yes (!) |
Here documents | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | No | No | No | Yes | No | Equivalent feature ("""string""" syntax) | Yes | Yes Lines without $ in COM file |
Unicode | Yes | No | Yes | ? | Yes | No | Yes | No | Yes | Yes | Yes | No | No | No | Yes | Yes | Yes | 1.9: Yes 1.8: limited | No |
Startup scripts | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes (4start) | Yes | No [11] | Yes (4start) | No | Yes | Yes (.bshrc) | Yes ($PYTHONSTARTUP or ipythonrc) | Yes (.irbrc) | Yes (login.com) |
Blocking of unsigned scripts | No | No | No | No | No | No | No | No | No | No | Yes | No | No | No | No | No | No | No | No |
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL | |
Bytecode | No | No | No | Yes (compiler is Scheme48 virtual machine, "scshvm") | Yes (compiler is called "shcomp") | No | Yes (built-in command "zcompile") | No | No | No | Yes, automatic | No | No | No | No | Yes | Yes (standardCPython,IronPython orJython) | Yes (NetRuby,JRuby, version 1.9/YARV) | No |
available as statically linked, independent single file executable | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | Yes | No | ? | Yes | Yes (bsh.jar) | Yes on Windows via py2exe | No | No |
Platform-independent | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | Yes via PASH | Yes[12] | No | No | Yes | Yes | Yes | Yes | No |
License | GPL | BSD | BSD | BSD-style | Common Public License | Public Domain | BSD-style | BSD-style | MS-EULA[13] | Shareware | MS-EULA[14] or BSD/GPL(PASH) | MS-EULA[15] or BSD/GPL (free clones) | MIT License, with restrictions | IBM-EULA[16] | Lucent Public License | LGPL | Python | Ruby, GPL | ? |
bash (v4.0) | csh | tcsh | Scsh | ksh (ksh93t+) | pdksh | zsh | ash | Windows cmd.exe[1] | 4NT | Windows PowerShell | COMMAND.COM | 4DOS | OS/2 cmd.exe | rc | BeanShell | Python shell | Ruby shell | VMS DCL |
[edit]
copy from:http://en.wikipedia.org/wiki/Comparison_of_computer_shells#cite_note-cmd_.2Fx-0