Comparison of command shells#Integrated environment
{{Short description|none}}
{{further|Shell (computing)}}
{{More citations needed|date=August 2011}}
{{Use dmy dates|date=May 2019|cs1-dates=y}}
File:Bash screenshot.png commands and resulting output.]]
This article catalogs comparable aspects of notable operating system shells.
General characteristics
{{sticky header}}
{{sort-under}}
class="wikitable sortable sticky-header sort-under" style="width: auto; text-align: center; font-size: smaller;" |
Shell
!{{small|Usual !{{small|Usually !{{small|Introduced}} !{{small|Platform-independent}} !{{small|Default login shell in}} !{{small|Default script shell in}} !{{small|License}} !{{small|Source code availability}} !{{small|User !{{small|Mouse !{{small|Unicode !{{small|ISO 8601 !{{small|Console redirection}} !{{small|Stream redirection}} !{{small|Configurability}} !{{small|Startup/shutdown scripts}} !{{small|Batch scripts}} !{{small|Logging}} !{{small|Available as statically linked, independent single file executable}} |
---|
Thompson shell
|UNIX |sh |1971 |{{N/A}} |UNIX |UNIX |{{N/A}} |{{yes}} |Text-based CLI |{{no}} |{{no}} |{{N/A}} |{{yes}} |{{N/A}} |{{N/A}} |{{N/A}} |{{N/A}} |{{N/A}} |{{N/A}} |
Bourne shell 1977 version
|sh |1977 |{{proprietary|ProprietaryThe historic UNIX V7 version is available under [http://minnie.tuhs.org/Archive/Caldera-license.pdf a BSD-style license] through The Unix Heritage Society and others.}} |{{yes}} |Text-based CLI |{{no}} |{{no}} |{{N/A}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |
Bourne shell current version
|Various UNIX |sh |1977 |SunOS-5.x |{{free|CDDL{{cite web |url=https://sourceforge.net/p/schillix-on/schillix-on/ci/default/tree/usr/src/cmd/sh/ |title=SchilliX-ON / SchilliX-ON Mercurial / [b1d9a2] /usr/src/cmd/sh |publisher=Sourceforge.net |access-date=2015-07-02}}{{better source needed|date=April 2015}}}} |{{yes}} |Text-based CLI |{{no}} |{{yes}}Since mid 1990s.{{better source needed|date=April 2015}} |{{N/A}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}}if compiled with -DACCT. |{{yes}} |
POSIX shell{{cite book |author=IEEE and The Open Group |title=IEEE 1003.1 Standard for Information Technology – Portable Operating System Interface (POSIX): Shell and Utilities, Issue 7 |date=2008}}
|sh |1992As part of IEEE Std.1003.2-1992 (POSIX.2); integrated into IEEE Std.1003.1 with the 2001 revision. |{{N/A}} |{{N/A}} |{{N/A}} |{{N/A}} |Text-based CLI |{{no}} |{{yes}} |{{N/A}} |{{yes}} |{{yes}} |{{yes}} |{{small|Unspecified |{{yes}} |{{yes}} |{{N/A}} |
bash (v4)
|bash, sh |1989{{Cite newsgroup |title=Bash is in beta release! |author-first=Brian |author-last=Fox |editor-first=Leonard H. |editor-last=Tower Jr. |date=1989-06-07 |newsgroup=gnu.announce |message-id=8906080235.AA01983@wheat-chex.ai.mit.edu |url=https://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=en |access-date=2010-10-28}} |{{yes}} |GNU, Linux (default for root), macOS 10.3–10.14 |GNU, Linux, Haiku, macOS 10.3–10.14 |{{free|GPL}} |{{yes}} |Text-based CLI |{{no}} |{{yes}}{{citation |chapter-url=http://tldp.org/LDP/abs/html/bashver4.html |title=Advanced Bash-Scripting Guide |chapter=Chapter 37.3.2. Bash, version 4.2 |author-first=Mendel |author-last=Cooper |publisher=The Linux Documentation Project |access-date=2015-04-30}}, "Bash now supports the \u and \U Unicode escape."{{better source needed|reason=Unicode escape is just a small part of Unicode support. There's also editing and string handling. This works in bash 4.3.33, but needs a source.|date=May 2015}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
csh
|csh |1978 |{{yes}} |{{dunno}} |{{free|BSD}} |{{yes}} |Text-based CLI |{{no}} |{{no}} |{{dunno}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
tcsh
|tcsh, csh |1983{{Cite newsgroup |author-first=Ken |author-last=Greer |title=C shell with command and filename recognition/completion |date=1983-10-03 |newsgroup=net.sources |url=https://groups.google.com/group/net.sources/msg/7073bf41cc5da330?hl=en |access-date=2010-12-29}} |{{yes}} |FreeBSD (former default for root),{{Cite web |title=FreeBSD Quickstart Guide for Linux® Users |url=https://docs.freebsd.org/en/articles/linux-users/ |access-date=2024-02-04 |website=FreeBSD Documentation Portal |language=en}} formerly Mac OS X |{{dunno}} |{{free|BSD}} |{{yes}} |Text-based CLI |{{no}} |{{yes}} |{{dunno}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
Hamilton C shell
|Win32, OS/2 |csh |1988{{cite journal |author-last=Sussman |author-first=Ann |title=Hamilton C Shell Speeds Development Of OS/2 Applications |journal=PC Week |date=1988-12-26 |issue=1988-12-26 - 1989-01-02 |page=37 |url=https://hamiltonlabs.com/archives/Hamilton-C-Shell-Speeds-Development-of-OS-2-Applications-Ann-Sussman-PC-Week-Dec-26-1988.pdf |access-date=2010-11-22}} |{{yes}} |{{optional}} |{{optional}} |{{proprietary}} |{{no}} |Text-based CLI |{{no}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
Scsh
|scsh |1994 |{{yes}} |{{dunno}} |{{dunno}} |{{free|BSD-style}} |{{yes}} |{{dunno}} |{{dunno}} |{{dunno}} |{{dunno}} |{{dunno}} |{{yes}} |{{dunno}} |{{dunno}} |{{dunno}} |{{dunno}} |{{yes}} |
ksh (ksh93t+)
|ksh |1983{{Cite newsgroup |author-first=Ron |author-last=Gomes |title=Toronto USENIX Conference Schedule (tentative) |date=1983-06-09 |newsgroup=net.usenix |url=https://groups.google.com/group/net.usenix/msg/fa6e1f7de3b63bba?hl=en {{Cite newsgroup |author-first=Guy |author-last=Harris |title=csh question |date=1983-10-10 |newsgroup=net.flame |url=https://groups.google.com/group/net.flame/msg/4f868085b65af530?hl=en |access-date=2010-12-29}} |{{yes}} |{{free|Common Public License}} |{{yes}} |Text-based CLI |{{no}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
pdksh
|ksh, sh |1989? |{{yes}} |OpenBSD[http://www.openbsd.org/faq/faq10.html#rootshell Default shell in OpenBSD] is ksh (pdksh). |{{free|Public domain}} |{{yes}} |Text-based CLI |{{no}} |{{no}} |{{N/A}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
zsh
|zsh |1990 |{{yes}} |Deepin, GoboLinux, Grml, macOS 10.15+, Kali 2020.4+ |{{free|MIT-style}} |{{yes}} |Text-based CLI |{{yes}} |{{yes}} |{{yes}} |
i}} option for the {{mono|fc}} builtin[http://linux.die.net/man/1/zshbuiltins zshbuiltins(1) man page])}}
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
ash
|sh |1989 |{{yes}} |NetBSD, Minix, BusyBox based systems |{{free|BSD-style}} |{{yes}} |Text-based CLI |{{no}} |{{partial}} |{{N/A}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
CCP
|(CCP) |1976 (1974) |{{no}} |{{proprietary|Freeware (originally proprietary)}} |{{yes}} (originally closed-source) |Text-based CLI |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} (automatic via {{mono|$$$.SUB}}) |{{partial}} |{{no}} |{{yes}} |
COMMAND.COM
|DOS |1980 |{{no}} |DOS, Windows 95, 98, SE, ME |DOS, Windows 95, 98, SE, ME |vendor specific, f.e. MS-EULA,MS-DOS and Windows component – covered by a valid license for MS-DOS or Microsoft Windows. or BSD/GPL (free clones) |{{no}} (except for OpenDOS, DR-DOS, PTS/DOS and FreeDOS) |Text-based CLI |{{no}} |{{no}} |{{no}} (except for DR-DOS) |{{yes}} (via {{mono|COMMAND con:}} or {{mono|CTTY con:}}) |{{yes}} |{{yes}} (via startup parameters and environment variables, DR-DOS also supports {{mono|DIR /C /R}} user-default switch command) |{{yes}} (automatic {{mono|\AUTOEXEC.BAT}} for primary shell, or explicitly via {{mono|/P}}, {{mono|/P:filename.bat}} or {{mono|/K}} startup options) |{{yes}} (via {{mono|CALL}} command or {{mono|/C}} and {{mono|/K}} startup options) |{{no}} |{{yes}} |
OS/2 CMD.EXE
|CMD |1987 |{{no}} |{{proprietary|IBM-EULA}}OS/2 component – covered by a valid license for OS/2. |{{no}} |Text-based CLI |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{dunno}} |{{partial}} (only via {{mono|/K}} startup option) |{{yes}} (via {{mono|CALL}} command or {{mono|/C}} and {{mono|/K}} startup options) |{{no}} |{{yes}} |
Windows CMD.EXECommand extensions enabled, or "CMD /X".
|CMD |1993 |{{no}} |Windows NT, 2000, XP, Server 2003, Vista |Windows NT, 2000, XP, Server 2003, Vista |{{proprietary|MS-EULA}}Windows component – covered by a valid license for Microsoft Windows. |{{no}} |Text-based CLI |{{no}} |{{partial}} ({{mono|CHCP 65001}} for UTF-8, but program arguments are still encoded in local codepage) |{{no}} |{{no}} |{{yes}} |{{yes}} (via registry, startup parameters, and environment variables) |{{yes}} (automatic via registry, or explicitly via {{mono|/K}} startup option) |{{yes}} (via {{mono|CALL}} command or {{mono|/C}} and {{mono|/K}} startup options) |{{no}} |{{yes}} |
4DOS, NDOS
|DOS, Windows 95, 98, SE, ME |1989 (1986) |{{no}} |{{optional}} |{{optional}} |{{free|MIT License, with restrictions}} |{{yes}} |Text-based CLI with TUI extensions |{{yes}} (popups, help system, {{mono|%_MOUSE}} internal variable, {{mono|INKEY /M}} command) |{{no}} |{{yes}} |{{yes}} (via {{mono|CTTY con:}}, except for {{mono|DRAWBOX}}, {{mono|DRAWLINE}}, {{mono|DRAWVLINE}}, {{mono|LIST}}, {{mono|SCREEN}}, {{mono|SCRPUT}}, {{mono|SELECT}}, {{mono|VSCRPUT}} commands and file / directory coloring) |{{yes}} |{{yes}} (via {{mono|4DOS.INI}}/{{mono|NDOS.INI}} file, startup parameters, environment variables, {{mono|SETDOS}} command) |{{yes}} (automatic {{mono|\AUTOEXEC.BAT}} for primary shell and {{mono|4START.BTM}}/{{mono|4START.BAT}} as well as {{mono|4EXIT.BTM}}/{{mono|4EXIT.BAT}} for any shell, or explicitly via {{mono|/P}}, {{mono|/P:dir\filename.ext}} or {{mono|/K}} startup options) |{{yes}} (via {{mono|CALL}} command or {{mono|/C}} and {{mono|/K}} startup options) |{{yes}} |{{yes}} |
4OS2
|4OS2 |1992 |{{no}} |{{optional}} (but bundled with ArcaOS) |{{optional}} |{{proprietary|Freeware}} |{{yes}} |Text-based CLI |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} (via {{mono|4OS2.INI}} file, startup parameters, environment variables, {{mono|SETDOS}} command) |{{yes}} (automatic via {{mono|4START.CMD}}/{{mono|4START.BTM}} as well as {{mono|4EXIT.CMD}}/{{mono|4EXIT.BTM}} files, or explicitly via {{mono|/K startup.cmd}} option) |{{yes}} (via {{mono|CALL}} command or {{mono|/C}} and {{mono|/K}} startup options) |{{yes}} |{{dunno}} |
TCC (formerly 4NT) |TCC |1993 |{{no}} |optional |optional |{{proprietary|Shareware}} |{{no}} |Text-based CLI (Take Command: GUI) |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |
VMS DCL{{cite web
|url=http://h71000.www7.hp.com/doc/732final/9996/9996pro_contents.html |title=HP OpenVMS DCL Dictionary |access-date=2009-03-23 |archive-url=https://web.archive.org/web/20070325041517/http://h71000.www7.hp.com/doc/732FINAL/9996/9996pro_contents.html |archive-date=25 March 2007 |url-status=dead }} |{{small|Automatically for login/interactive process}} |1977? |{{yes}} |VMS |VMS |Proprietary, bundled in VMS |{{no|by special license only}} |Text-based CLI |{{yes|with DECwindows/Motif}} |{{yes}} |{{yes|Yes, at least to 1988 standard}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |
PowerShell
|PowerShell |2006 |{{yes}} |Windows 10, 8, Server 2008, 7Microsoft PowerShell is installed by default on Windows 7 and later. It is an optional download for users of Windows Vista or Windows XP. |Windows 10, 8, Server 2008, 7 |{{free|MIT-style}} |{{yes}} |Graphical CLI |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |
rc
|rc |1989 |{{yes}} |{{free|MIT License{{cite web |url=https://www.phoronix.com/scan.php?page=news_item&px=Plan-9-2021 |title=Plan 9 Copyright Transferred To Foundation, MIT Licensed Code Released |last=Larabel |first=Michael |date=2021-03-23 |website=Phoronix |access-date=2021-03-28}}}} |{{yes}} |Text-based CLI |{{dunno}} |{{yes}} |{{yes}} |{{dunno}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{dunno}} |{{yes}} |
BeanShell
|Java |{{dunno}} |2005 |{{yes}} |{{dunno}} |{{dunno}} |{{free|LGPL}} |{{dunno}} |{{dunno}} |{{dunno}} |{{yes}} |{{dunno}} |{{dunno}} |{{yes}} |{{dunno}} |{{dunno}} |{{dunno}} |{{dunno}} |{{no}} |
fish
|fish |2005{{cite web |title=Fish - The friendly interactive shell |author-first=Axel |author-last=Liljencrantz |date=2005-05-17 |url=https://lwn.net/Articles/136232/ |access-date=2013-04-08}} |{{yes}} |{{dunno}} |{{free|GPL}} |{{yes}} |Text-based CLI |{{dunno}} |{{yes}} |{{dunno}} |{{dunno}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{dunno}} |
Ion
|ion |2015{{cite web |title=d79c8f511573fb7710abc63b4236a40022914520 |author-first=Jeremy |author-last=Soller |date=2015-11-15 |url=https://gitlab.redox-os.org/redox-os/ion/commit/d79c8f511573fb7710abc63b4236a40022914520 |access-date=2019-08-03}} |{{yes}} |{{free|MIT}} |{{yes}} |Text-based CLI |{{dunno}} |{{yes}} |{{yes}} |{{dunno}} |{{yes}} |{{yes}} |{{yes}} |{{yes|Yes}} |{{yes}} |{{partial}} (not distributed as a standalone executable, but it can be built as one) |
Shell
!Usual environment !Usually invoked !Introduced !Default login shell in !Default script shell in !License !Source code availability !User interface !Mouse support !Unicode support !ISO 8601 support !Configurability !Startup/shutdown scripts !Batch scripts !Logging !Available as statically linked, independent single file executable |
Interactive features
{{sticky header}}
{{sort-under}}
class="wikitable sortable sort-under sticky-header" style="width: auto; text-align: center; font-size: smaller;" |
Shell
!{{small|Command !{{small|Path !{{small|Command !{{small|Wildcard !{{small|Command !{{small|Mandatory !{{small|Automatic !{{small|Colored !{{small|Text !{{small|Syntax !{{small|Directory history, stack or similar features}} !{{small|Implicit !{{small|Autocorrection}} !{{small|Integrated !{{small|Snippets}} !{{small|Value !{{small|Menu/options !{{small|Progress !{{small|Context |
---|
Thompson shell
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |? |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
Bourne shell 1977 version
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |? |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
Bourne shell current version
|{{no}} |{{yes}}current versions from Jörg Schilling. |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} (CDPATH, pushd, popd, dirs), CDPATH since SVr4 |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
POSIX shell
|{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
bash (v4.0)
|{{yes}} |{{yes}} |{{yes}} |{{yes}}Alt-Shift-8 or Alt-* will expand to the full matching list of filenames. |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes|optional}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{partial|External}} |{{no}} |
csh
|{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes|optional}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
tcsh
|{{yes}} |{{yes}} |{{yes2|when defined}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes|optional}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
Hamilton C shell
|{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
Scsh
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |? |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{partial|External}} |{{no}} |
ksh (ksh93t+)
|{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{partial|External}} |{{no}} |
pdksh
|{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{partial|External}} |{{no}} |
zsh
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}}This applies only on reserved words and other syntactic features. |{{yes}} |{{yes}} |{{yes}} |{{partial|Third-party extension}}zsh does not feature syntax highlighting, but a 3rd party project exists which offers this capability as an add-on: [https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting] |{{yes}} |{{yes|optional}} |{{yes}} |{{no}} |{{yes2|when defined (as ZLE widgets)}} |{{yes}} |{{yes}} |{{partial|External}} |{{yes}} |
ash
|{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{partial|External}} |{{no}} |
CCP
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
COMMAND.COM
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}}Available through the {{mono|DOSKEY}} add-on.Available in DR-DOS through {{mono|HISTORY}}. |{{no}} |{{no}} |{{no}} |{{no}} (only in DR-DOS through %$ON%, %$OFF%, %$HEADER%, %$FOOTER%) |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} (only single-stepping with COMMAND /Y) |{{no}} |{{no}} |{{no}} (only via external {{mono|CHOICE}} command, in DR-DOS also via {{mono|SWITCH}} / {{mono|DRSWITCH}} internal commands) |{{no}} |{{no}} |
OS/2 CMD.EXE |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
Windows CMD.EXE |{{yes2|partial}} |{{yes2|partial}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} (via {{mono|SET /P}} command) |{{no}} |{{no}} |{{no}} |
4DOS
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}}Alternatively available through the {{mono|DOSKEY}} add-on as well.Alternatively available in DR-DOS through {{mono|HISTORY}} as well. |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes| (via popup, extended directory searches, {{mono|CDPATH}}, {{mono|PUSHD}}, {{mono|POPD}}, {{mono|DIRHISTORY}}, {{mono|DIRS}}, {{mono|CDD}}, {{mono|CD -}} commands and {{mono|%@DIRSTACK[]}} function)}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{yes}} (via {{mono|INPUT}}, {{mono|INKEY}} and {{mono|ESET}} commands) |{{yes}} (via {{mono|@SELECT[]}} function, and indirectly via a combination of {{mono|INKEY}}, {{mono|INPUT}}, {{mono|SWITCH}} commands) |{{no}} |{{yes}} |
4OS2
|? |? |? |? |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |? |{{no}} |? |? |{{no}} |{{yes}} |
TCC (formerly 4NT)
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{yes}} |{{yes| (via popup, extended directory searches, {{mono|CDPATH}}, {{mono|PUSHD}}, {{mono|POPD}}, {{mono|DIRHISTORY}}, {{mono|DIRS}}, {{mono|CDD}}, {{mono|CD -}} commands and {{mono|%@DIRSTACK[]}} function)}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{yes}} (via {{mono|INPUT}}, {{mono|INKEY}}, {{mono|ESET}} and {{mono|SET /P}} commands) |{{yes}} (via {{mono|@SELECT[]}} function, and indirectly via a combination of {{mono|INKEY}}, {{mono|INPUT}}, {{mono|SWITCH}} commands)TCC has special prompt functions for Yes, No, Cancel, Close, Retry. |{{no}} |{{yes}} |
PowerShell
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes|Yes; via PSReadLine{{cite web |url=https://github.com/lzybkr/PSReadLine|title=PSReadLine: A bash inspired readline implementation for PowerShell|first=Jason|last=Shirk|date=15 February 2018|via=GitHub}} module (bundled in v5.0{{Cite web |url=https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/core-modules/windows-powershell-5.0 |title=Windows PowerShell 5.0 |access-date=8 September 2016 |archive-url=https://web.archive.org/web/20160917093943/https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/core-modules/windows-powershell-5.0 |archive-date=17 September 2016 |url-status=dead |df=dmy-all }}) or in ISE}} |{{partial|Third-party extension}}{{Cite web|url=https://github.com/joonro/Get-ChildItemColor|title = Get-ChildItemColor|website = GitHub|date = 18 March 2022}} |{{yes}}{{Cite web | title = Write-Host (Microsoft.PowerShell.Utility) - PowerShell | author = sdwheeler | work = docs.microsoft.com | date = | access-date = 18 January 2022 | url = https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/write-host | quote = }} |{{yes|Yes; via PSReadLine module (bundled in v5.0) or in ISE}} |{{yes}} |{{yes2}}Yes, in PSReadLine module |{{yes}} |
rc
|{{yes}}Handled by rio, GNU readline, editline or vrl. |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |? |{{no}} |{{no}} |{{no}} |
BeanShell
|{{yes}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |? |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
VMS DCL
|{{yes|Minimum uniqueness scheme}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |? |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |
fish
|{{yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}}The fish shell is an interactive character based input/output surface. |{{yes| Yes, using {{mono|abbr}} command}} |{{yes}} |{{yes| (via {{mono|fish_config}} command{{Cite web|title=abbr - manage fish abbreviations — fish-shell 3.1.2 documentation|url=https://fishshell.com/docs/current/cmds/abbr.html|access-date=2021-02-23|website=fishshell.com}})}} |{{no}} |{{no}} |
Shell
!Directory history, stack or similar features !Integrated !Snippets !Value !Menu/options |
= Background execution =
Background execution allows a shell to run a command without user interaction in the terminal, freeing the command line for additional work with the shell. POSIX shells and other Unix shells allow background execution by using the & character at the end of command.
= Completions =
{{main article|Command-line completion}}
Image:Command-line-completion-example.gif.]]Completion features assist the user in typing commands at the command line, by looking for and suggesting matching words for incomplete ones. Completion is generally requested by pressing the completion key (often the {{keypress|TAB}} key).
Command name completion is the completion of the name of a command. In most shells, a command can be a program in the command path (usually $PATH
), a builtin command, a function or alias.
Path completion is the completion of the path to a file, relative or absolute.
Wildcard completion is a generalization of path completion, where an expression matches any number of files, using any supported syntax for file matching.
Variable completion is the completion of the name of a variable name (environment variable or shell variable).
Bash, zsh, and fish have completion for all variable names. PowerShell has completions for environment variable names, shell variable names and — from within user-defined functions — parameter names.
Command argument completion is the completion of a specific command's arguments. There are two types of arguments, named and positional: Named arguments, often called options, are identified by their name or letter preceding a value, whereas positional arguments consist only of the value. Some shells allow completion of argument names, but few support completing values.
Bash, zsh and fish offer parameter name completion through a definition external to the command, distributed in a separate completion definition file. For command parameter name/value completions, these shells assume path/filename completion if no completion is defined for the command. Completion can be set up to dynamically suggest completions by calling a shell function.{{cite web |url=https://zsh.sourceforge.io/Doc/Release/Completion-System.html |title=zsh: 20. Completion System |publisher=Zsh.sourceforge.io |date=2013-03-06 |access-date=2013-08-18}} The fish shell additionally supports parsing of man pages to extract parameter information that can be used to improve completions/suggestions. In PowerShell, all types of commands (cmdlets, functions, script files) inherently expose data about the names, types and valid value ranges/lists for each argument. This metadata is used by PowerShell to automatically support argument name and value completion for built-in commands/functions, user-defined commands/functions as well as for script files. Individual cmdlets can also define dynamic completion of argument values where the completion values are computed dynamically on the running system.
= Command history =
{{main article|Command history}}
Users of a shell may find themselves typing something similar to what they have typed before. Support for command history means that a user can recall a previous command into the command-line editor and edit it before issuing the potentially modified command.
Shells that support completion may also be able to directly complete the command from the command history given a partial/initial part of the previous command.
Most modern shells support command history. Shells which support command history in general also support completion from history rather than just recalling commands from the history. In addition to the plain command text, PowerShell also records execution start- and end time and execution status in the command history.
= Mandatory argument prompt =
{{further|Named parameter#Optional parameters}}
Mandatory arguments/parameters are arguments/parameters which must be assigned a value upon invocation of the command, function or script file. A shell that can determine ahead of invocation that there are missing mandatory values, can assist the interactive user by prompting for those values instead of letting the command fail. Having the shell prompt for missing values will allow the author of a script, command or function to mark a parameter as mandatory instead of creating script code to either prompt for the missing values (after determining that it is being run interactively) or fail with a message.
= Automatic suggestions =
{{main article|Autocomplete}}
Image:Powershell Intellisense example for the Get-Process cmdlet.gif.]]Shells featuring automatic suggestions display optional command-line completions as the user types. The PowerShell and fish shells natively support this feature; pressing the {{keypress|tab}} key inserts the completion.
Implementations of this feature can differ between shells; for example, PowerShell{{Cite web|last=sdwheeler|title=What's New in the PowerShell 5.0 ISE - PowerShell|url=https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/whats-new/what-s-new-in-the-powershell-50-ise|access-date=2021-07-25|website=docs.microsoft.com|language=en-us}} and zsh{{Cite web|title=GitHub - marlonrichert/zsh-autocomplete: 🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.|url=https://github.com/marlonrichert/zsh-autocomplete|access-date=2021-07-25|website=GitHub|language=en}} use an external module to provide completions, and fish derives its completions from the user's command history.{{Cite web|title=Interactive use — fish-shell 3.3.1 documentation|url=https://fishshell.com/docs/current/interactive.html#autosuggestions|access-date=2021-07-25|website=fishshell.com}}
= Directory history, stack or similar features =
{{Further|pushd and popd}}
Shells may record a history of directories the user has been in and allow for fast switching to any recorded location. This is referred to as a "directory stack". The concept had been realized as early as 1978{{Cite book|last=Hahn|first=Harley|url=https://www.worldcat.org/oclc/184828059|title=Harley Hahn's guide to Unix and Linux|date=2009|publisher=McGraw-Hill Higher Education|isbn=978-0-07-313361-4|location=Boston|oclc=184828059}} in the release of the C shell (csh).
Command line interpreters 4DOS and its graphical successor Take Command Console also feature a directory stack.
= Implicit directory change =
A directory name can be used directly as a command which implicitly changes the current location to the directory.
This must be distinguished from an unrelated load drive feature supported by Concurrent DOS, Multiuser DOS, System Manager and REAL/32, where the drive letter L: will be implicitly updated to point to the load path of a loaded application, thereby allowing applications to refer to files residing in their load directory under a standardized drive letter instead of under an absolute path.{{cite book |title=Concurrent DOS 386 - Multiuser/Multitasking Operating System - User Guide |publisher=Digital Research |url=http://bitsavers.org/pdf/digitalResearch/concurrent/1126-2004-001_Concurrent_DOS_386_Users_Guide_Nov87.pdf}}
= Autocorrection =
File:Zsh autocompletion and autocorrection demo.gif program.]]
When a command line does not match a command or arguments directly, spell checking can automatically correct common typing mistakes (such as case sensitivity, missing letters). There are two approaches to this; the shell can either suggest probable corrections upon command invocation, or this can happen earlier as part of a completion or autosuggestion.
The tcsh and zsh shells feature optional spell checking/correction, upon command invocation.
Fish does the autocorrection upon completion and autosuggestion. The feature is therefore not in the way when typing out the whole command and pressing enter, whereas extensive use of the tab and right-arrow keys makes the shell mostly case insensitive.
The PSReadLine PowerShell module (which is shipped with version 5.0) provides the option to specify a CommandValidationHandler ScriptBlock which runs before submitting the command. This allows for custom correcting of commonly mistyped commands, and verification before actually running the command.
= Progress indicator =
A shell script (or job) can report progress of long running tasks to the interactive user.
Unix/Linux systems may offer other tools support using progress indicators from scripts or as standalone-commands, such as the program "pv".{{cite web |url=http://linux.die.net/man/1/pv |title=pv(1): monitor progress of data through pipe - Linux man page |publisher=Linux.die.net |access-date=2015-02-24}} These are not integrated features of the shells, however.
= Colored directory listings =
JP Software command-line processors provide user-configurable colorization of file and directory names in directory listings based on their file extension and/or attributes through an optionally defined {{code|%COLORDIR%}} environment variable.
For the Unix/Linux shells, this is a feature of the {{mono|ls}} command and the terminal.
= Text highlighting =
The command line processors in DOS Plus, Multiuser DOS, REAL/32 and in all versions of DR-DOS support a number of optional environment variables to define escape sequences allowing to control text highlighting, reversion or colorization for display or print purposes in commands like TYPE. All mentioned command line processors support %$ON%
and %$OFF%
. If defined, these sequences will be emitted before and after filenames. A typical sequence for {{code|%$ON%}} would be {{code|\033[1m}} in conjunction with ANSI.SYS, {{code|\033p}} for an ASCII terminal or {{code|\016}} for an IBM or ESC/P printer. Likewise, typical sequences for {{code|%$OFF%}} would be {{code|\033[0m}}, {{code|\033q}}, {{code|\024}}, respectively. The variables %$HEADER%
and %$FOOTER%
are only supported by COMMAND.COM in DR-DOS 7.02 and higher to define sequences emitted before and after text blocks in order to control text highlighting, pagination or other formatting options.
For the Unix/Linux shells, this is a feature of the terminal.
= Syntax highlighting =
{{main article|Syntax highlighting}}
A defining feature of the fish shell is built-in syntax highlighting, As the user types, text is colored to represent whether the input is a valid command or not (the executable exists and the user has permissions to run it), and valid file paths are underlined.{{Cite web |title=fish: Tutorial |url=https://fishshell.com/docs/3.0/tutorial.html#tut_syntax_highlighting |access-date=2022-10-21 |website=fishshell.com}}
An independent project offers syntax highlighting as an add-on to the Z Shell (zsh).{{cite web |url=https://github.com/zsh-users/zsh-syntax-highlighting |title=zsh-users/zsh-syntax-highlighting: Fish shell like syntax highlighting for Zsh |website=GitHub |access-date=2013-08-18}} This is not part of the shell, however.
PowerShell provides customizable syntax highlighting on the command line through the PSReadLine module. This module can be used with PowerShell v3.0+, and is bundled with v5.0 onwards. It is loaded by default in the command line host "powershell.exe" since v5.0.{{Cite web |last=sdwheeler |title=PSReadLine Module - PowerShell |url=https://learn.microsoft.com/en-us/powershell/module/psreadline/ |access-date=2023-04-26 |website=learn.microsoft.com |language=en-us}}
Take Command Console (TCC) offers syntax highlighting in the integrated environment.
=Context sensitive help=
{{main article|Context-sensitive help}}
4DOS, 4OS2, 4NT / Take Command Console and PowerShell (in PowerShell ISE) looks up context-sensitive help information when {{keypress|F1}} is pressed.
Zsh provides various forms of configurable context-sensitive help as part of its {{mono|run-help}} widget, {{mono|_complete_help}} command, or in the completion of options for some commands.
The fish shell provides brief descriptions of a command's flags during tab completion.
Programming features
{{sort-under}}
class="wikitable sortable sort-under" style="width: auto; text-align: center; font-size: smaller;" |
Shell
!Search & replace !{{verth|Arithmetic}} !{{verth|Floating point}} !Math function library !Linear arrays or lists !{{verth|Associative !{{verth|Lambda !{{verth|eval |
---|
Bourne shell 1977 version
|{{no}} |{{yes| Yes (via {{mono|trap}})}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
Bourne shell current version
|{{yes| Yes since SVR2}} |{{yes| Yes (via {{mono|trap}})}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
POSIX shell
|{{yes}} |{{yes| Yes (via {{mono|trap}})}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
bash (v4.0)
|{{yes}} |{{yes| Yes (via {{mono|trap}})}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{no}} |
csh
|{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
tcsh
|{{partial|Work in progress[https://github.com/tcsh-org/tcsh/pull/77 Introduce 'function' built-in] by Matheus Garcia}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
Hamilton C shell
|{{yes}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes| Yes (random utility)}} |{{no}} |
Scsh
|{{yes}} |? |{{yes}} |? |? |? |{{yes}} |? |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
ksh (ksh93t+)
|{{yes}} |{{yes| Yes (via {{mono|trap}})}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |
pdksh
|{{yes}} |{{yes| Yes (via {{mono|trap}})}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |
zsh
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |
ash
|{{yes}} |{{yes}} (via {{mono|trap}}) |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
CCP
|{{no}} |? |{{no}} |{{no}} |? |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
COMMAND.COM
|{{no}} |{{partial}} (only Auto-fail (via {{mono|COMMAND /F}} (or {{mono|/N}} in some versions of DR-DOS)) |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
OS/2 CMD.EXE
|{{no}} |{{no}} |{{no}} |? |{{no}} |{{no}} |? |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
Windows CMD.EXE
|{{yes}} |{{no}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |
4DOS
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |? |? |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |
4OS2
|? |? |? |? |? |? |? |? |{{no}} |{{yes}} |{{yes}} ({{mono|%@Random[...]}} function) |? |
TCC (formerly 4NT)
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |? |? |{{yes}} |? |{{no}} |{{yes}} |{{yes}} ({{mono|%@Random[...]}} function) |{{yes}} (via {{mono|BATCOMP}} command) |
PowerShell
|{{yes}} |{{yes}} (Try-Catch-Finally) |{{yes}} |
replace}} operator)}}
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes|Yes, automatic}} |
rc
|{{yes}} |{{yes}} |{{no}} |{{yes}} |? |? |{{yes}} |? |{{no}} |{{yes}} |{{no}} |{{no}} |
BeanShell
|{{yes}} |{{yes}} |? |{{yes}} |? |? |{{yes}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{yes}} |
VMS DCL
|{{yes}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{yes|yes, for compiled programs}} |{{yes}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
fish
|{{yes}} |{{yes| Yes (via {{mono|trap}})}} |{{yes|Yes, via {{mono|string}} builtin command{{Cite web|title=string - manipulate strings — fish-shell 3.1.2 documentation|url=https://fishshell.com/docs/current/cmds/string.html|access-date=2021-02-23|website=fishshell.com}}}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{no}} |{{yes}} |{{yes}} |{{no}} |
String processing and filename matching
{{sort-under}}
class="wikitable sortable sort-under" style="width: auto; text-align: center; font-size: smaller;" |
Shell
!String processing !Alternation (Brace expansion) !Pattern matching (regular expressions built-in) !Pattern matching (filename globbing) !Globbing qualifiers (filename generation based on file attributes) !Recursive globbing (generating files from any level of subdirectories) |
---|
Bourne shell 1977 version
|? |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
Bourne shell recent version
|{{partial}} (prefix and suffix stripping in variable expansion) |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
POSIX shell
|{{partial}} (prefix and suffix stripping in variable expansion) |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
bash (v4.0)
|{{partial}} (prefix and suffix stripping in variable expansion) |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} ({{mono|**/...}}) |
csh
|{{yes}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{no}} |
tcsh
|{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |{{no}} |
Hamilton C shell
|{{yes}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{yes}} |url=https://hamiltonlabs.com/UserGuide/31-Wildcarding.htm |title=Hamilton C shell Language reference: Wildcarding and pattern matching |access-date=2013-10-29 |publisher=Hamilton Laboratories |quote={{mono|...}} Indefinite Directory: match any number of directory levels – zero or more – whatever it takes to make the rest of the pattern match.}})}} |
Scsh
|? |? |{{yes}} |{{yes}} |{{no}} |{{no}} |
ksh (ksh93t+)
|{{partial}} (prefix, suffix stripping and string replacement in variable expansion) |{{yes}}{{cite book |author-last1=Seebach |author-first1=Peter |title=Beginning Portable Shell Scripting: From Novice to Professional |url=https://books.google.com/books?id=53zaxy423xcC |series=Expert's voice in open source |date=21 November 2008 |publisher=Apress |publication-date=2008 |page=149 |isbn=9781430210436 |access-date=2014-09-17 |quote=Brace expansion is available in ksh93, pdksh, bash, and zsh.}} |{{yes}} |{{yes}} |{{no}} |{{yes}} (with {{mono|set -G}}, no following of symlinks) |
pdksh
|? |{{no}} |{{yes}} |{{no}} |{{no}} |
zsh
|{{yes}} (through variable processing: e.g. substring extraction, various transformations via parameter expansion) |{{yes}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} ({{mono|**/...}} or {{mono|***/...}} to follow symlinks) |
ash
|? |? |{{no}} |{{yes}} |{{no}} |{{no}} |
CCP
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
COMMAND.COM
|{{no}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{no}} |
OS/2 CMD.EXE
|{{no}} |{{no}} |{{no}} |{{yes}} |{{partial}} (only in {{mono|DIR /A:...}} command) |{{no}} |
Windows CMD.EXE
|{{partial}} (only through {{mono|FOR /F}} and {{mono|SET /A}}) |{{no}} |{{yes}} |{{partial}} (only in {{mono|DIR /A:...}} command) |{{yes}} (via {{mono|FOR /R}} command, or, where available, indirectly via {{mono|/S}} subdir option) |
4DOS
|{{yes}} (through variable functions {{mono|%@...[]}}, extended environment variable processing, various string commands and {{mono|FOR /F}} and {{mono|SET /A}}) |{{no}} |{{no}} |{{yes}} |{{yes}} (via {{mono|/A:...}} attribute and {{mono|/I"..."}} description options and {{mono|/[S...]}} size, {{mono|/[T...]}} time, {{mono|/[D...]}} date, and {{mono|/[!...]}} file exclusion ranges) |{{yes}} (via {{mono|FOR /R}} command, or indirectly via {{mono|GLOBAL}} command or, where available, {{mono|/S}} subdir option) |
4OS2
|? |{{no}} |{{no}} |? |? |? |
TCC (formerly 4NT)
|{{yes}} (through variable functions {{mono|%@...[]}}, extended environment variable processing, various string commands and {{mono|FOR /F}} and {{mono|SET /A}}) |{{no}} |{{yes}} |{{yes}} |{{yes}} (via {{mono|/A:...}} attribute and {{mono|/I"..."}} description options and {{mono|/[S...]}} size, {{mono|/[T...]}} time, {{mono|/[D...]}} date, {{mono|/[O...]}} owner, and {{mono|/[!...]}} file exclusion ranges) |{{yes}} (via {{mono|FOR /R}} command, or indirectly via {{mono|GLOBAL}} command or, where available, {{mono|/S}} subdir option) |
PowerShell
|{{yes}} |{{partial|Range operator for numbers{{Cite web | title = about Operators - PowerShell | author = sdwheeler | work = docs.microsoft.com | date = | access-date = 18 January 2022 | url = https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators | quote = }}}} |{{yes}} |{{yes}} |? |? |
rc
|? |? |{{no}} |{{yes}} |{{no}} |{{no}} |
BeanShell
|? |? |{{yes}} |? |? |? |
VMS DCL
|{{yes}} |{{no}} |{{no}} |{{yes}} |{{no}} |{{yes}} (via {{mono|[SUBDIR...]}}) |
fish
|{{yes}} |{{yes|Yes}} |{{yes}} |{{yes}} |{{no}} |{{yes}} ({{mono|**/...}}) |
Inter-process communication
class="wikitable sortable" style="width: auto; text-align: center; font-size: smaller;" |
Shell
!Subshells |
---|
Bourne shell
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{N/A|N/A}}xautomation and xdotool can be used to generate keystrokes under X Window System; or a program can be run in a pseudoterminal to be able to control it (as with the {{mono|expect}} tool). |
POSIX shell
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |
bash (v4.0)
|{{yes|bytes concurrent}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
csh
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |
tcsh
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |
Hamilton C shell
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |? |
Scsh
|{{yes|text}} |? |? |? |{{yes}} |
ksh (ksh93t+)
|{{yes|bytes (may contain serialized objects if {{mono|print -C}} is used) concurrent}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
pdksh
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |
zsh
|{{yes|bytes concurrent}} |{{yes}} |{{yes}} |{{yes}} |{{yes}} |
ash
|{{yes|bytes concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |
CCP
|{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |{{no}} |
COMMAND.COM
|{{yes|text sequential temporary files}} |{{no}} |{{no}} |{{partial}} (only under DR-DOS multitasker via {{mono|COMMAND.COM /T}}) |{{no}} |{{no}} |
OS/2 CMD.EXE
|{{yes|text concurrent}} |{{no}} |{{no}} |? |{{no}} |{{no}} |
Windows CMD.EXE
|{{yes|text concurrent}} |{{yes}} |{{no}} |{{yes}} |{{no}} |{{no}} |
4DOS
|{{yes|text sequential temporary files}} |{{yes}} |? |{{partial}} (via {{mono|%@EXECSTR[]}} and {{mono|%@EXEC[]}}, or via {{mono|SET /M}}, {{mono|ESET /M}} and {{mono|UNSET /M}} and {{mono|%@MASTER[...]}}) |{{no}} |{{yes}} (via {{mono|KEYSTACK}} and {{mono|KSTACK}}){{cite book |title=4DOS 8.00 online help |title-link=4DOS 8.00 |author-first1=Hardin |author-last1=Brothers |author-first2=Tom |author-last2=Rawson |author-link2=Tom Rawson |author-first3=Rex C. |author-last3=Conn |author-link3=Rex C. Conn |author-first4=Matthias R. |author-last4=Paul |author-first5=Charles E. |author-last5=Dye |author-first6=Luchezar I. |author-last6=Georgiev |date=2002-02-27}} |
4OS2
|{{yes|text concurrent}} |? |? |? |{{no}} |{{yes}} (via {{mono|KEYSTACK}}) |
TCC (formerly 4NT)
|{{yes|text concurrent}} |{{yes}} |? |{{partial}} (via {{mono|%@EXECSTR[]}} and {{mono|%@EXEC[]}}) |{{yes}} (via {{mono|FTP}}, {{mono|TFTP}}, {{mono|FTPS}}, {{mono|SFTP}}, {{mono|HTTP}}, {{mono|HTTPS}} and {{mono|IFTP}}, client only) |{{yes}} (via {{mono|KEYSTACK}}) |
PowerShell
|{{yes|objects concurrent}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |? |
rc
|{{yes|text concurrent}} |{{yes}} |{{yes}} |{{yes}} |{{no}} |? |
BeanShell
|{{no|not supported}} |? |? |? |{{yes}} |? |
VMS DCL
|{{yes|text (via {{mono|PIPE}} command)}} |{{yes}} |{{no}} |{{yes}} |{{yes}} |{{no}} |
fish
|{{yes|bytes concurrent}} |{{yes}} ({{mono|...}}) |{{no}} |{{no}} |
=Keystroke stacking=
In anticipation of what a given running application may accept as keyboard input, the user of the shell instructs the shell to generate a sequence of simulated keystrokes, which the application will interpret as a keyboard input from an interactive user. By sending keystroke sequences the user may be able to direct the application to perform actions that would be impossible to achieve through input redirection or would otherwise require an interactive user. For example, if an application acts on keystrokes, which cannot be redirected, distinguishes between normal and extended keys, flushes the queue before accepting new input on startup or under certain conditions, or because it does not read through standard input at all. Keystroke stacking typically also provides means to control the timing of simulated keys being sent or to delay new keys until the queue was flushed etc. It also allows to simulate keys which are not present on a keyboard (because the corresponding keys do not physically exist or because a different keyboard layout is being used) and therefore would be impossible to type by a user.
Security features
{{importance section|date=July 2014}}
{{sort-under}}
= Secure prompt =
Some shell scripts need to query the user for sensitive information such as passwords, private digital keys, PIN codes or other confidential information. Sensitive input should not be echoed back to the screen/input device where it could be gleaned by unauthorized persons. Plaintext memory representation of sensitive information should also be avoided as it could allow the information to be compromised, e.g., through swap files, core dumps etc.{{cite web |author-last=Provos |author-first=Niels |title=Encrypting Virtual Memory |url=http://www.openbsd.org/papers/swapencrypt.ps |publisher=Center for Information Technology Integration, University of Michigan |access-date=2012-12-20}}
The shells bash, zsh and PowerShell offer this as a specific feature.{{cite web |url=https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html |title=bash - GNU Bourne-Again SHell |quote=read -s Silent mode. If input is coming from a terminal, characters are not echoed.}}{{cite web |url=https://technet.microsoft.com/en-us/library/ee176935.aspx |title=Using the Read-Host Cmdlet |quote=By adding the -assecurestring parameter you can mask the data entered at the prompt}} Shells which do not offer this as a specific feature may still be able to turn off echoing through some other means. Shells executing on a Unix/Linux operating system can use the {{mono|stty}} external command to switch off/on echoing of input characters.{{cite web |title=Linux / Unix Command: stty |url=http://linux.about.com/od/commands/l/blcmdl1_stty.htm |publisher=Linux.about.com |access-date=2015-02-24 |archive-date=2015-02-25 |archive-url=https://web.archive.org/web/20150225005431/http://linux.about.com/od/commands/l/blcmdl1_stty.htm |url-status=dead }} In addition to not echoing back the characters, PowerShell's {{code|-AsSecureString}} option also encrypts the input character-by-character during the input process, ensuring that the string is never represented unencrypted in memory where it could be compromised through memory dumps, scanning, transcription etc.
= Execute permission =
Some operating systems define an execute permission which can be granted to users/groups for a file when the file system itself supports it.
On Unix systems, the execute permission controls access to invoking the file as a program, and applies both to executables and scripts.
As the permission is enforced in the program loader, no obligation is needed from the invoking program, nor the invoked program, in enforcing the execute permission{{Snd}} this also goes for shells and other interpreter programs.
The behaviour is mandated by the POSIX C library that is used for interfacing with the kernel. POSIX specifies that the exec
family of functions shall fail with EACCESS (permission denied) if the file denies execution permission (see {{man|sh|execve|SUS}}).
The execute permission only applies when the script is run directly. If a script is invoked as an argument to the interpreting shell, it will be executed regardless of whether the user holds the execute permission for that script.
Although Windows also specifies an execute permission, none of the Windows-specific shells block script execution if the permission has not been granted.
= Restricted shell subset =
Several shells can be started or be configured to start in a mode where only a limited set of commands and actions is available to the user. While not a security boundary (the command accessing a resource is blocked rather than the resource) this is nevertheless typically used to restrict users' actions before logging in.
A restricted mode is part of the POSIX specification for shells, and most of the Linux/Unix shells support such a mode where several of the built-in commands are disabled and only external commands from a certain directory can be invoked.{{cite web |url=http://pwet.fr/man/linux/commandes/posix/sh |title=man sh - shell, the standard command language interpreter / posix |language=fr |publisher=Pwet.fr |access-date=2013-08-18 |archive-url=https://web.archive.org/web/20141221210713/http://pwet.fr/man/linux/commandes/posix/sh |archive-date=21 December 2014 |url-status=dead }}{{cite web |url=https://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell.html |title=Bash Reference Manual: The Restricted Shell |publisher=Gnu.org |date=2010-12-28 |access-date=2013-08-18}}
PowerShell supports restricted modes through session configuration files or session configurations. A session configuration file can define visible (available) cmdlets, aliases, functions, path providers and more.{{cite web |url=https://technet.microsoft.com/en-us/library/hh849712.aspx |title=New-PSSessionConfigurationFile |publisher=Technet.microsoft.com |access-date=2013-08-18}}
= Safe data subset =
Scripts that invoke other scripts can be a security risk as they can potentially execute foreign code in the context of the user who launched the initial script. Scripts will usually be designed to exclusively include scripts from known safe locations; but in some instances, e.g. when offering the user a way to configure the environment or loading localized messages, the script may need to include other scripts/files.{{cite book |author-last1=Albing |author-first1=Carl |title=Bash cookbook |year=2007 |publisher=O'Reilly Media |location=Sebastopol, California, USA |isbn=978-0-596-52678-8 |edition=1st |author-last2=Vossen |author-first2=J. P. |author-last3=Newham |author-first3=Cameron |quote=[...] is hardly what one thinks of as a passive list of configured variables. It can run other commands (e.g., cat) and use if statements to vary its choices. It even ends by echoing a message. Be careful when you source something, as it's a wide open door into your script.}} One way to address this risk is for the shell to offer a safe subset of commands which can be executed by an included script.
Notes
{{Reflist|group="nb"}}
References
External links
- {{cite book |url= https://www.linux-magazine.com/Issues/2007/78/Bash-vs.-Vista-PowerShell |date= May 2007 |title= Comparing Bash with the Windows Vista shell: Shell Games |first= Marcus |last= Nasarek |publisher= Linux Magazine |chapter= Article |chapter-url= https://www.linux-magazine.com/content/download/63303/487727/version/1/file/Bash_vs._Vista_PowerShell.pdf |url-status= live |archive-date= Oct 10, 2014 |archive-url= https://web.archive.org/web/20141010000744/http://w3.linux-magazine.com/issue/78/Bash_vs._Vista_PowerShell.pdf }}
- {{cite web |url= https://pubs.opengroup.org/onlinepubs/9799919799/utilities/contents.html |title= Shell and Utilities |date= 2024-08-08 |edition= 2024 |issue= 8 |work= IEEE Standard for Information Technology 1003.1™-2024 – Portable Operating System Interface POSIX™.1-2024 — The Open Group Base Specifications Issue 8 |publisher= The IEEE and The Open Group }}
{{Unix shells}}
{{DEFAULTSORT:Comparison Of Command Shells}}