Comparison of computer shells

From Wikipedia, the free encyclopedia

For more details on this topic, see Shell (computing).

A shell is a command line interface computer program of an operating system.

bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell
Usual environment POSIX POSIX POSIX POSIX POSIX POSIX POSIX POSIX Win32 Win32 .NET DOS DOS OS/2 Plan 9, POSIX Java Python Ruby
Introduced 1987 1978 1981 ? 1994 1982 1989 ? 1990 1989 1993 1993 2006 1980 1989 1987 1989 2005 1991 1995
Tab completion Yes (extendable) Yes (via the ESC key) Yes (extendable) No Yes (extendable) Yes Yes (extendable) No Yes Yes Yes (extendable) No Yes Yes Yes[2] Yes Yes (provided by the rlcompleter module or IPython) Yes
Pipes Yes (concurrent) Yes (concurrent) Yes (concurrent) Yes Yes (concurrent), normal data and compound variable objects Yes (concurrent) Yes (concurrent) Yes (concurrent) Yes (concurrent) Yes Yes (.NET objects) Yes (sequential, with temporary files) Yes (sequential, with temporary files) Yes (concurrent) Yes (concurrent) ? Yes Yes
Integer arithmetic Yes (via $(( )) syntax) Yes (via @ syntax) Yes (via @ syntax) Yes Yes (via $(( )), (( )) and let syntax) Yes (via $(( )) syntax) Yes (via $(( )) syntax) Yes [3] Yes (via "set /a") Yes (via %@eval[ ] function) Yes No Yes (via %@eval[ ] function) No No Yes Yes Yes
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
Scientific notation No (except for printf %f/%g) No No Yes Yes (including C99-style base16 notation) No Yes No No Yes[4] Yes No No No No Yes Yes Yes
Binary prefix notation No No No Yes No No No No No ? Yes No ? No No ? ? ?
Hash tables No No No Yes (via module) Yes (via associative arrays) No Yes No No No Yes No No No No Yes Yes Yes
Compound Variables No No No Yes (via records or lists) Yes No ? No No ? Yes No ? ? ? ? ? ?
Pattern Matching (regular expressions) Yes No No Yes Yes No Yes No No Limited support Yes No No No No Yes Yes Yes
Pattern Matching (globbing) Yes (*, ?, [...]) Yes Yes Yes Yes (*, ?, [...]) Yes Yes (*, ?, [...]) Yes Yes (*, ?) Yes (*, ?, [...]) Yes (*, ?, [...]) Yes (*, ?) Yes (*, ?, [...]) Yes (*, ?) Yes ? Yes ?
bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell
Globbing qualifiers (filename generation based on file attributes) No No No No No No Yes No ? ? ? ? ? ? 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 ? ? ?
Directory stack (pushd/popd) Yes Yes Yes No No ? Yes ? Yes Yes Yes No Yes ? ? ? ? ?
Command history Yes Yes Yes No Yes Yes Yes No Yes (F7) Yes Yes No[5][6] Yes Yes Yes[2] Yes Yes Yes
History completion Yes Yes Yes No Yes ? Yes No Yes (F8) Yes Yes (F8) No[5][6] Yes ? Yes[2] ? Yes (provided by IPython) ?
Spell checking No No Yes No No No Yes No No No No No No No No No No ?
Default user prompt[7] 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) ?
Exception handling Yes (via trap) ? ? ? Yes (via trap) ? Yes Yes (via trap) No No Yes No No No Yes Yes Yes Yes
bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell
One-dimensional array variables Yes Yes Yes Yes Yes Yes Yes No No No Yes No No No Yes Yes Yes Yes
Multi-dimensional array variables No No No Yes Yes (via associative arrays) No Yes (via associative arrays) No No No Yes No No No Yes Yes Yes Yes
Array slicing Yes (${var:offset:length} syntax) No No No Yes (${var:offset:length} syntax) No Yes (${var[from,to]} syntax) No No No Yes No No No Yes ($var(i j k)) No Yes Yes
Stream redirection 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
Aliases Yes Yes Yes Yes (macro and procedure definitions) Yes Yes Yes Yes Yes ("macros", via doskey) Yes Yes No Yes No Yes (functions) ? Yes (functions) 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:expression syntax) 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)
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 ?
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>) ? ? ?
Quoting Yes Yes Yes No Yes Yes Yes Yes Limited Yes (Backtick: `) Yes No Yes (Backtick: `) ? 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: \)
Parallel assignment No No No No ? ? ? No No No Yes No No No ? ? Yes Yes
bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell
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: `)
Job control Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No No No Handled by rio ? Yes ?
Functions Yes No No Yes Yes Yes Yes Yes Yes (via "call :label") Yes Yes No Yes No Yes Yes Yes Yes
Variadic functions Yes No No Yes Yes Yes Yes Yes No No Yes No ? No Yes No Yes Yes
Default arguments Yes No No No Yes Yes Yes Yes No ? Yes No ? No Yes No Yes Yes
Named parameters No No No No No No No No No No Yes No ? No ? No Yes Yes
Lambda functions No No No Yes No No No No No No Yes No No No No No Yes Yes
eval function Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes No Yes Yes Yes Yes
bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell
(De-)Serialization of composite datatypes No No ? No Yes No ? No No ? Yes No ? No ? Yes Yes Yes
Pseudorandom number generation Yes No No Yes (random-integer, random-real) Yes Yes Yes No Yes (%random%) Yes (%@random[ ] function) Yes No Yes (%@random[ ] function) No No Yes Yes Yes
TCP/UDP connections 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
Native CIM/WBEM support No No No No No No No No No No Yes 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 (#) 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 (#)
Here documents Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No No Yes No Equivalent feature ("""string""" syntax) Yes
Unicode Yes No No ? Yes No Yes No Yes Yes Yes No No No Yes Yes Yes ?
Startup scripts Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes (4start) Yes No [8] Yes (4start) No Yes Yes (.bshrc) Yes ($PYTHONSTARTUP or ipythonrc) Yes (.irbrc)
Blocking of unsigned scripts No No No No No No No No No No Yes No No No No No No ?
bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell
Bytecode Planned[9] No No Yes (compiler is Scheme48 virtual machine, "scshvm") Yes (compiler is called "shcomp") No Yes (built-in command "zcompile") No No No Yes No No No No Yes Yes (standard CPython, IronPython or Jython) Yes (NetRuby, JRuby)
available as statically linked, independent single file executable Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes (requires manual configuration) Yes No ? Yes Yes (bsh.jar) No No
Platform-independent Yes Yes Yes Yes Yes Yes Yes Yes No No No Yes[10] No No Yes Yes Yes Yes
Available as
Free Software
(as defined by the FSF)
Yes Yes Yes Yes Yes Yes Yes Yes No No No Yes[10] No[11] No Yes Yes Yes Yes
bash (v3.1) csh tcsh Scsh ksh (ksh93s+) pdksh zsh ash Windows
cmd.exe[1]
4NT Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell

[edit] References

  1. ^ a b c d e f g Command extensions enabled, or "cmd /x".
  2. ^ a b c Handled by rio, GNU readline, editline or vrl
  3. ^ Available in modern versions of ash such as NetBSD's sh or Debian ash
  4. ^ Scientific notation is supported for input only; numeric results are always displayed in common format.
  5. ^ a b Added by TSR programs such as DOSKey
  6. ^ a b Available in DR-DOS via the "history" command in config.sys; see this link
  7. ^ Many shells in *nix environments change the root user's prompt to '#'.
  8. ^ Limited support via AUTOEXEC.BAT.
  9. ^ Integration of bash-support is planned for Parrot.
  10. ^ a b Refers only to some implementations, such as on DosBox, Wine, and FreeDOS.
  11. ^ Licensed under modified MIT License but it "may not be used in any commercial product without written permission from Rex Conn" so it does not qualify as free software. See See README.TXT inside http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/util/user/4dos/7.50.1/4dos7501.zip for exact licensing terms.