Comparison of command shells

Comparison of command shells

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

Contents

General characteristics

Bourne shell POSIX shell[1] bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe[2]
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL[3]
Usual environment 7th Ed. UNIX POSIX POSIX POSIX POSIX POSIX POSIX POSIX POSIX POSIX Win32 Win32 .NET DOS DOS OS/2 Plan 9, POSIX Java Python Ruby OpenVMS
Usually invoked sh sh bash, sh csh tcsh, csh scsh ksh ksh, sh zsh sh cmd ? powershell command ? cmd rc ? python, ipython irb ?
Introduced 1977 1992[4] 1989[5] 1978 1983[6] 1994 1983[7][8] 1989 ? 1990 1989 1993 1993 2006 1980 1989 1987 1989 2005 1991 1995 1977 ?
Platform-independent No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No
(3rd party in dev[9])
No
(3rd party available[10])
No No Yes Yes Yes Yes No
Default login shell in 7th Ed. UNIX N/A GNU, Mac OS X 10.3+ ? FreeBSD, formerly Mac OS X AIX HP-UX OpenBSD[11] Grml, Gobolinux Minix, BusyBox based systems Windows NT, 2000, XP, Server 2003, Vista ? Windows Server 2008, 7, Vista, XP[12] DOS, Windows 95, 98, ME ? OS/2 Plan 9, Version 10 Unix ? ? ? VMS
Default script shell in 7h Ed. UNIX POSIX GNU,
Haiku
? ? ? OpenSolaris OpenBSD[11] Grml FreeBSD, NetBSD, Minix, BusyBox based systems Windows NT, 2000, XP, Server 2003, Vista ? Windows Server 2008, 7 DOS, Windows 95, 98, ME ? OS/2 Plan 9, Version 10 Unix ? ? ? VMS
License AT&T prop.[13] N/A GPL BSD BSD BSD-style Common Public License Public Domain BSD-style BSD-style MS-EULA[14] 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 ?
Unicode No Yes, if used by configured locale Yes No Yes ? Yes No Yes Yes Yes Yes Yes No No No Yes Yes Yes 1.9: Yes
1.8: limited
No
Stream redirection Yes (arbitrary fds) Yes (arbitrary fds) Yes (arbitrary fds) Yes (stdin, out, out+err) Yes (stdin, out, out+err) Yes Yes (arbitrary fds) Yes (arbitrary fds) Yes (arbitrary fds) Yes (arbitrary fds) Yes Yes (stdin, out, err) Yes Yes (stdin, out, COMn/LPT only) Yes (stdin, out, err) Yes (stdin, out, err) Yes Yes Yes Yes Yes (sys$input, sys$output assignment)
Native CIM/WBEM support No No No No No No No No No No No No Yes No No No No ? ? ? No
Blocking of unsigned scripts No No No No No No No No No No No No Yes No No No No No No No No
available as statically linked, independent single file executable Yes N/A Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No ? Yes Yes (bsh.jar) Yes on Windows via py2exe No No
Bourne shell POSIX shell[17] bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe[2]
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL[18]

Interactive features

Bourne shell POSIX shell bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL
Completion No No 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[19] Yes Yes (provided by the rlcompleter module or IPython) Yes No
Directory stack (pushd/popd) No No Yes Yes Yes No No No Yes Yes Yes Yes Yes (all location types)[20] 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 No No Yes Yes No Yes No No No No No No
Implicit Directory Change - If command is dir name changes to it No No Yes
(optional)
Yes
(optional)
Yes
(optional)
No No No Yes
(optional)
No No Yes No No Yes No No No No No No
Command history No Yes Yes Yes Yes No Yes Yes Yes Yes Yes (F7) Yes Yes No[21][22] Yes Yes Yes[19] Yes Yes Yes Yes
History completion No No Yes Yes Yes No Yes ? Yes Yes Yes (F8) Yes Yes (F8) No[21][22] Yes ? Yes[19] ? Yes (provided by IPython) Yes (with UtilityBelt gem) No
Spell checking No No No No experimental No No No Yes No No No No No No No No No No No No
Default user prompt[23] 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: $PS1) 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)
Aliases No Yes Yes Yes Yes Yes (macro and procedure definitions) Yes Yes Yes Yes Yes ("macros", via doskey) Yes Yes Yes (using SET or registry) Yes No Yes (functions) ? Yes (functions) Yes Yes
Binary prefix notation No No No No No Yes No No No No No ? Yes No ? No No ? ? ? Yes
Job control No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No No No Handled by rio ? Yes Yes Yes
Startup scripts Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes (4start) Yes No[24] Yes (4start) No Yes Yes (.bshrc) Yes ($PYTHONSTARTUP or ipythonrc) Yes (.irbrc) Yes (login.com)

Programming features

Bourne shell POSIX shell bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL
Functions No Yes Yes No No Yes Yes Yes Yes Yes Yes (via "call :label") Yes Yes No Yes No Yes Yes Yes Yes Yes
Exception handling Yes (via trap) Yes (via trap) Yes (via trap) No No ? Yes (via trap) Yes (via trap) Yes Yes (via trap) No No Yes No No No Yes Yes Yes Yes Yes
Search and replace on variables No No 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) No
Parallel assignment No No No No No No ? ? ? No No No Yes No No No ? ? Yes Yes No
Variadic functions No Yes Yes No No Yes Yes Yes Yes Yes No No Yes No ? No Yes No Yes Yes No
Default arguments No No 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 No No Yes (for user-defined "types") No No No No No Yes No ? No ? No Yes Yes No
Lambda functions No No No No No Yes No No No No No No Yes No No No No No Yes Yes No
eval function Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes No Yes Yes Yes Yes No
Pseudorandom number generation No No Yes ($RANDOM) No No Yes (random-integer, random-real) Yes ($RANDOM) Yes ($RANDOM) Yes ($RANDOM) No Yes (%random%) Yes (%@random[ ] function) Yes No Yes (%@random[ ] function) No No Yes Yes Yes No
Bytecode No No 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 (standard CPython, IronPython or Jython) Yes (NetRuby, JRuby, version 1.9/YARV) No

Syntax

Bourne shell POSIX shell bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL
Quoting Yes Yes 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 (Backslash: \) Yes (Backslash: \) Yes (Caret: ^) Yes Yes (Backtick: `) No Yes Yes Yes Yes (Backslash: \) Yes (Backslash: \) Yes (Backslash: \) Yes (quotes or string assignment)
Comments No Yes (#) 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 (!)
Scientific notation No No No No No Yes Yes (including C99-style base16 notation %a/%A and typeset -X) No Yes No No Yes[25] Yes No No No No Yes Yes Yes No
Here documents Yes Yes 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

Data types

Bourne shell POSIX shell bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL
Integer arithmetic No Yes (via $(( )) ) 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[26] Yes (via "set /a") Yes (via %@eval[ ] function) Yes No Yes (via %@eval[ ] function) No No Yes Yes Yes Yes
Typing discipline only one type dynamic
weak
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 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 No No Yes Yes No Yes No No Yes Yes Yes Yes
Hash tables No No 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 No No Yes (via records or lists) Yes No ? No No No Yes No No ? ? ? Yes (via tuples) Yes No
One-dimensional array variables No No 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 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 No No 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
(De-)Serialization of composite datatypes No No No No ? No Yes (print -C var, read -C var) No ? No No No Yes No No No ? Yes Yes Yes No

String and filename matching

Bourne shell POSIX shell bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL
Pattern Matching (regular expressions built-in) No No Yes No Yes Yes Yes No Yes No Yes (via the findstr /r command) Limited support Yes (full regex support)[27] No No No No Yes Yes Yes No
Pattern Matching (globbing) Yes (*, ?, [...]) Yes (*, ?, [...]) Yes (*, ?, [...], {...}) Yes Yes Yes Yes (*, ?, [...]) Yes Yes (*, ?, [...],
ext'd globbing[28])
Yes Yes (*, ?) Yes (*, ?, [...]) Yes (*, ?, [...]) Yes (*, ?) Yes (*, ?, [...]) Yes (*, ?) Yes ? Yes Yes (via Dir.glob() method) Yes
Globbing qualifiers (filename generation based on file attributes) No No No No No No No No Yes No ? ? ? ? ? ? No ? Yes (via glob module) ? No
Recursive globbing (generating files from any level of subdirectories) No No 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...] )

Inter-process communication

Bourne shell POSIX shell bash (v4.0) csh tcsh Scsh ksh (ksh93t+) pdksh zsh ash Windows
cmd.exe
TCC (formerly 4NT) Windows PowerShell COMMAND.COM 4DOS OS/2
cmd.exe
rc BeanShell Python shell Ruby shell VMS DCL
Pipes bytes
concurrent
bytes
concurrent
bytes
concurrent
bytes
concurrent
bytes
concurrent
text bytes
(may contain serialized objects if print -C is used)
concurrent
bytes
concurrent
bytes
concurrent
bytes
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)
Command substitution Yes Yes Yes Yes Yes ? Yes ($(...) and ${<space>...;}) 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 No No 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
Subshells Yes Yes 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)
TCP/UDP connections as streams No No 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)

References

  1. ^ IEEE (6 December 2001). 1003.1™ Standard for Information Technology — Portable Operating System Interface (POSIX®): Shell and Utilities, Issue 6. 
  2. ^ a b Command extensions enabled, or "cmd /x".
  3. ^ "HP OpenVMS DCL Dictionary". http://h71000.www7.hp.com/doc/732final/9996/9996pro_contents.html. Retrieved 2009-03-23. 
  4. ^ As part of IEEE Std.1003.2-1992 (POSIX.2); integrated into IEEE Std.1003.1 with the 2001 revision.
  5. ^ Brian Fox (forwarded by Leonard H. Tower Jr.) (Jun 7 1989). "Bash is in beta release!". gnu.announce. (Web link). Retrieved Oct 28 2010. 
  6. ^ Ken Greer (Oct 3 1983). "C shell with command and filename recognition/completion". net.sources. (Web link). Retrieved Dec 29 2010. 
  7. ^ Ron Gomes (Jun 9 1983). "Toronto USENIX Conference Schedule (tentative)". net.usenix. (Web link). Retrieved Dec 29 2010. 
  8. ^ Guy Harris (Oct 10 1983). "csh question". net.flame. (Web link). Retrieved Dec 29 2010. 
  9. ^ PASH, a third-party remake, is in development and almost half-finished. Activity seems to have stagnated early 2009.
  10. ^ Third-party re-implementations, such as DosBox, Wine, and FreeDOS are available.
  11. ^ a b Default shell in OpenBSD is ksh (pdksh).
  12. ^ Windows PowerShell is installed with Windows 7, however, it is an optional download for users of Windows Vista or Windows XP.
  13. ^ Now available under a BSD-style license through the Unix Heritage Society and others.
  14. ^ a b Windows component — covered by a valid license for Microsoft Windows
  15. ^ MS-DOS and Windows component — covered by a valid license for MS-DOS or Microsoft Windows
  16. ^ OS/2 component — covered by a valid license for OS/2
  17. ^ IEEE (6 December 2001). 1003.1™ Standard for Information Technology — Portable Operating System Interface (POSIX®): Shell and Utilities, Issue 6. 
  18. ^ "HP OpenVMS DCL Dictionary". http://h71000.www7.hp.com/doc/732final/9996/9996pro_contents.html. Retrieved 2009-03-23. 
  19. ^ a b c Handled by rio, GNU readline, editline or vrl
  20. ^ PowerShell exposes more than just the file system as a navigable system: Windows Registry, functions, aliases, variables, certificate store, credential store etc. The location types are extensible through a provider architecture. Common commands will work with any compliant provider
  21. ^ a b Added by TSR programs such as DOSKey
  22. ^ a b Available in DR-DOS via the "history" command in config.sys; see this link
  23. ^ Many shells in *nix environments change the root user's prompt to '#'.
  24. ^ Limited support via AUTOEXEC.BAT.
  25. ^ Scientific notation is supported for input only; numeric results are always displayed in common format.
  26. ^ Available in modern versions of ash such as NetBSD's sh or Debian ash
  27. ^ PowerShell leverages the full .NET regular expression engine which features named captures, zero-width lookahead/-behind, greedy/non-greedy, character classes, level counting etc.
  28. ^ Zsh offers an almost overwhelming variety of globbing options.

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Comparison of operating systems — Usage share of web client operating systems. (Source: Median values from Usage share of operating systems for August 2011.)   Windows XP (35.21%) …   Wikipedia

  • Command Prompt — For other uses, see Command prompt (disambiguation). CMD redirects here. For other uses, see CMD (disambiguation). Command Prompt A component of Microsoft Windows …   Wikipedia

  • Command line completion — is a common feature of command line interpreters, in which the program automatically fills in partially typed tokens. Depending on the specific interpreter and its configuration, these elements may include commands, arguments, environment… …   Wikipedia

  • COMMAND.COM — Developer(s) Seattle Computer Products, Microsoft Corporation, IBM, Novell and several others. Operating system DR DOS, FreeDOS, MS DOS, Novell DOS, OpenDOS, PC DOS, PTS DOS, ROM DOS, 86 DOS, Microsoft Windows (Windows 95 Wi …   Wikipedia

  • Command-line interface — Screenshot of a sample Bash session. GNOME Terminal 3, Fedora 15 …   Wikipedia

  • Command-line completion — Example of command line completion in Bash. Command line completion (also tab completion) is a common feature of command line interpreters, in which the program automatically fills in partially typed commands. Command line interpreters are… …   Wikipedia

  • Command-line interpreter — A command line interpreter (also command line shell, command language interpreter) is a computer program that reads lines of text entered by a user and interprets them in the context of a given operating system or programming language. Command… …   Wikipedia

  • Command Prompt (Windows) — Infobox Windows component name = Command Prompt logo size = 64px caption = Command Prompt in Windows Vista| included with = Windows NT Windows CE OS/2 replaces = COMMAND.COM replaced by = related components = Windows PowerShell Batch filecmd.exe… …   Wikipedia

  • Comparison of programming languages (mapping) — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Comparison of file archivers — This is an incomplete list, which may never be able to satisfy particular standards for completeness. You can help by expanding it with reliably sourced entries. The following tables compare general and technical information for a number of file… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”