Skip to content
Surf Wiki
Save to docs
general/command-shells

From Surf Wiki (app.surf) — the open knowledge base

Comparison of command shells

none


none

This article catalogs comparable aspects of notable operating system shells.

General characteristics

ShellLicenseMouse supportUnicode
supportISO 8601
supportStream redirectionConfigurabilityStartup/shutdown
scriptsLoggingThompson shellBourne shell 1977 versionBourne shell current versionPOSIX shellbash (v4)cshtcshHamilton C shellScshksh (ksh93t+)pdkshzshashCCPCOMMAND.COMOS/2 CMD.EXEWindows CMD.EXECommand extensions enabled, or "CMD /X".[4DOS](4dos), NDOS[4OS2](4os2)TCC
(formerly 4NT)VMS DCL{{cite webPowerShellrcBeanShellfishIon
UNIXsh1971UNIXUNIXText-based CLI
7th Ed. UNIXsh19777th Ed. UNIX7th Ed. UNIX,Text-based CLI
(via variables and options)
()
(Unix feature)
Various UNIXsh1977SunOS-5.x, FreeBSDSunOS-5.xText-based CLIdate=April 2015}}
(via variables and options)
()
(Unix feature)if compiled with -DACCT.
POSIXsh1992POSIXText-based CLI
if used by configured locale
(via variables and options){{smallUnspecified
( given as an example)
(Unix feature)
POSIXbash, sh1989{{Cite newsgrouptitle=Bash is in beta release!author-first=Brianauthor-last=Foxeditor-first=Leonard H.editor-last=Tower Jr.date=1989-06-07newsgroup=gnu.announcemessage-id=8906080235.AA01983@wheat-chex.ai.mit.eduurl=https://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=enaccess-date=2010-10-28}}GNU, Linux (default for root), macOS 10.3–10.14GNU, Linux, Haiku, macOS 10.3–10.14Text-based CLI
( builtin)
(via variables and options)
(, , , , )
(Unix feature)
POSIXcsh1978SunOSText-based CLI
(, , )
(via variables and options)
(, , )
(Unix feature)
POSIXtcsh, csh1983{{Cite newsgroupauthor-first=Kenauthor-last=Greertitle=C shell with command and filename recognition/completiondate=1983-10-03newsgroup=net.sourcesurl=https://groups.google.com/group/net.sources/msg/7073bf41cc5da330?hl=enaccess-date=2010-12-29}}FreeBSD (former default for root), formerly Mac OS XText-based CLI
(, , )
(via variables and options)
(, , , , , , )
(Unix feature)
Win32, OS/2csh1988{{cite journalauthor-last=Sussmanauthor-first=Anntitle=Hamilton C Shell Speeds Development Of OS/2 Applicationsjournal=PC Weekdate=1988-12-26issue=1988-12-26 - 1989-01-02page=37url=https://hamiltonlabs.com/archives/Hamilton-C-Shell-Speeds-Development-of-OS-2-Applications-Ann-Sussman-PC-Week-Dec-26-1988.pdfaccess-date=2010-11-22}}
(OS/2 version no longer maintained)Text-based CLI
(-t timestamp operator)
(, , )
(via variables and options)
(via login.csh, startup.csh and logout.csh)
(command line option)
POSIXscsh1994
POSIXksh1983{{Cite newsgroupauthor-first=Ronauthor-last=Gomestitle=Toronto USENIX Conference Schedule (tentative)date=1983-06-09newsgroup=net.usenixurl=https://groups.google.com/group/net.usenix/msg/fa6e1f7de3b63bba?hl=enaccess-date=2010-12-29}}author-first=Guyauthor-last=Harristitle=csh questiondate=1983-10-10newsgroup=net.flameurl=https://groups.google.com/group/net.flame/msg/4f868085b65af530?hl=enaccess-date=2010-12-29}}AIX, HP-UXOpenSolarisText-based CLI
( builtin with )
( up to 9)
(via variables and options)
(system and user's and )
(Unix feature)
POSIXksh, sh1989?OpenBSDOpenBSDText-based CLI
(via variables and options)
(, )
(Unix feature)
POSIXzsh1990Deepin, GoboLinux, Grml, macOS 10.15+, Kali 2020.4+Grml, macOS 10.15+Text-based CLI
via additional code
(various internal features involving the date, by using the format and the option for the builtin)
( up to 9)
(via variables, options, functions, styles, etc.)
(system and user's , , , , )
(Unix feature)
POSIXsh1989Minix, BusyBox based systemsNetBSD, Minix, BusyBox based systemsText-based CLI
(for BusyBox, supported in command-line editing, but not in string handling)
(via variables and options)
(, )
(Unix feature)
CP/M, MP/M(CCP)1976 (1974)CP/M (no login), MP/MCP/M, MP/M(originally closed-source)Text-based CLI(automatic via )
(only via external command to update )
DOSCOMMAND1980
(3rd party implementations, not bound to a specific DOS vendor or version, available)DOS, Windows 95, 98, SE, MEDOS, Windows 95, 98, SE, MEvendor 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)(except for OpenDOS, DR-DOS, PTS/DOS and FreeDOS)Text-based CLI(except for DR-DOS)(via or )
(, )(via startup parameters and environment variables, DR-DOS also supports user-default switch command)(automatic for primary shell, or explicitly via , or startup options)(via command or and startup options)
OS/2, eComStation, ArcaOSCMD1987OS/2, eComStation, ArcaOSOS/2, eComStation, ArcaOSOS/2 component – covered by a valid license for OS/2.Text-based CLI
(, , )(only via startup option)(via command or and startup options)
Win32CMD1993Windows NT, 2000, XP, Server 2003, VistaWindows NT, 2000, XP, Server 2003, VistaWindows component – covered by a valid license for Microsoft Windows.Text-based CLI( for UTF-8, but program arguments are still encoded in local codepage)(via registry, startup parameters, and environment variables)(automatic via registry, or explicitly via startup option)(via command or and startup options)
DOS, Windows 95, 98, SE, ME[4DOS](4dos), NDOS1989 (1986)
(not bound to a specific OS vendor or version)Text-based CLI with TUI extensions(popups, help system, internal variable, command)(via , except for , , , , , , , commands and file / directory coloring)
(, , , )(via / file, startup parameters, environment variables, command)(automatic for primary shell and / as well as / for any shell, or explicitly via , or startup options)(via command or and startup options)
OS/2, eComStation, ArcaOS[4OS2](4os2)1992
(not bound to specific OS/2 versions)(but bundled with ArcaOS)Text-based CLI
(, , , )(via file, startup parameters, environment variables, command)(automatic via / as well as / files, or explicitly via option)(via command or and startup options)
Win32TCC1993
(not bound to specific NT versions)optionaloptionalText-based CLI (Take Command: GUI)
(console mouse, popups, help system, , internal variables, command)
(, , , )
(via registry, / file, startup parameters, environment variables, command)
(automatic via registry and / as well as /, or explicitly via startup option)
(via command or and startup options)
url=http://h71000.www7.hp.com/doc/732final/9996/9996pro_contents.htmltitle=HP OpenVMS DCL Dictionaryaccess-date=2009-03-23archive-url=https://web.archive.org/web/20070325041517/http://h71000.www7.hp.com/doc/732FINAL/9996/9996pro_contents.htmlarchive-date=25 March 2007url-status=deadOpenVMSAutomatically for login/interactive process1977?VMSVMSProprietary, bundled in VMSText-based CLI
(, assignment)
(via symbols, logical names, and options)
(SYS$MANAGER:SYLOGIN.COM and user defined LOGIN.COM)
.NET,
.NET FrameworkPowerShell2006Windows 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, 7Graphical CLI
(via variables and options)
(%USERPROFILE%\Documents \WindowsPowerShell\Microsoft.PowerShell_profile.ps1)
(PowerShell feature)
Plan 9, POSIXrc1989Plan 9, Version 10 UnixPlan 9, Version 10 Unix{{freeMIT License{{cite weburl=https://www.phoronix.com/scan.php?page=news_item&px=Plan-9-2021title=Plan 9 Copyright Transferred To Foundation, MIT Licensed Code Releasedlast=Larabelfirst=Michaeldate=2021-03-23website=Phoronixaccess-date=2021-03-28}}}}Text-based CLI
(via options)
()
Java2005
POSIXfish2005{{cite webtitle=Fish - The friendly interactive shellauthor-first=Axelauthor-last=Liljencrantzdate=2005-05-17url=https://lwn.net/Articles/136232/access-date=2013-04-08}}GhostBSDText-based CLI
(through environment variables and via web interface through )
( and )
(Unix feature)
()
Redox, Linuxion2015{{cite webtitle=d79c8f511573fb7710abc63b4236a40022914520author-first=Jeremyauthor-last=Sollerdate=2015-11-15url=https://gitlab.redox-os.org/redox-os/ion/commit/d79c8f511573fb7710abc63b4236a40022914520access-date=2019-08-03}}RedoxRedoxText-based CLI
(follows the XDG Base Directory spec)
()
()(not distributed as a standalone executable, but it can be built as one)

Interactive features

ShellThompson shellBourne shell 1977 versionBourne shell current versionPOSIX shellbash (v4.0)cshtcshHamilton C shellScshksh (ksh93t+)pdkshzshashCCPCOMMAND.COMOS/2
CMD.EXEWindows
CMD.EXE[4DOS](4dos)[4OS2](4os2)TCC (formerly 4NT)PowerShellrcBeanShellVMS DCLfish
??
??
current versions from Jörg Schilling.(CDPATH, pushd, popd, dirs), CDPATH since SVr4
()
Alt-Shift-8 or Alt-* will expand to the full matching list of filenames.
(, , )
(, , )
(, , )
(, , )
??
(extendable)
(extendable)
( builtin, , implemented as functions)
(via or user-defined)
DOSKEY}} add-on.Available in DR-DOS through .(only in DR-DOS through %$ON%, %$OFF%, %$HEADER%, %$FOOTER%)(only single-stepping with COMMAND /Y)(only via external command, in DR-DOS also via / internal commands)
()
(, )(via command)
DOSKEY}} add-on as well.Alternatively available in DR-DOS through as well.(via , and commands)(via function, and indirectly via a combination of , , commands)
???????
(via , , and commands)(via function, and indirectly via a combination of , , commands)TCC has special prompt functions for Yes, No, Cancel, Close, Retry.
(){{Cite webtitle = Write-Host (Microsoft.PowerShell.Utility) - PowerShellauthor = sdwheelerwork = docs.microsoft.comdate =access-date = 18 January 2022url = https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/write-hostquote =
(multiple stacks; multiple location types; , )Yes, in PSReadLine moduletitle=Windows PowerShell Integrated Scripting Environment (ISE)url=https://technet.microsoft.com/en-us/library/dd819514.aspx?f=255&MSPPError=-2147217396publisher=Microsoft Technetaccess-date=2015-09-12}}Yes, in ISE, in ISE
rio]], GNU readline, editline or vrl.??
??
??
url=http://fishshell.com/docs/current/index.html#completiontitle=fish: Documentationat=Section *Tab completion*access-date=2016-01-10}}
(built-in helper available)The fish shell is an interactive character based input/output surface.

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

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. 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

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

tab}} key inserts the completion.

Implementations of this feature can differ between shells; for example, PowerShell and zsh use an external module to provide completions, and fish derives its completions from the user's command history.

Directory history, stack or similar features

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 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.

Autocorrection

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". 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 environment variable.

For the Unix/Linux shells, this is a feature of the 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 would be in conjunction with ANSI.SYS, for an ASCII terminal or for an IBM or ESC/P printer. Likewise, typical sequences for would be , , , 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.

An independent project offers syntax highlighting as an add-on to the Z Shell (zsh). 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.

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 is pressed.

Zsh provides various forms of configurable context-sensitive help as part of its widget, 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

ShellFunctionsException handlingSearch & replace
on variable substi­tutionsMath function libraryLinear arrays or listsPseudo­random number generationBytecodeBourne shell 1977 versionBourne shell current versionPOSIX shellbash (v4.0)cshtcshHamilton C shellScshksh (ksh93t+)pdkshzshashCCPCOMMAND.COMOS/2 CMD.EXEWindows CMD.EXE[4DOS](4dos)[4OS2](4os2)TCC (formerly 4NT)PowerShellrcBeanShellVMS DCLfish
(via } syntax)
()
(via syntax)
(via syntax)
(via syntax)
?
(via string functions and regular expressions)????
(random-integer, random-real)
(compiler is Scheme48 virtual machine, via )
(via } syntax and builtin commands)
()
(compiler is called )
()
(via } and } syntax)
( module)
()
(built-in command)
(via )
(since 1992)
???
(only Auto-fail (via (or in some versions of DR-DOS))
??
(via )
(via syntax)
(via )
(via )
()
(via command, optional Auto-fail via )
(via function)
(via )??
(via ranges, include lists, file lists and command)
( function)
(via command)
????????( function)?
(via and various commands)
(via function)
(via )??
(via ranges, include lists, file lists and command)?( function)(via command)
(Try-Catch-Finally)
( operator)
???
???
()

String processing and filename matching

ShellString processingAlternation (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 versionBourne shell recent versionPOSIX shellbash (v4.0)cshtcshHamilton C shellScshksh (ksh93t+)pdkshzshashCCPCOMMAND.COMOS/2 CMD.EXEWindows CMD.EXE[4DOS](4dos)[4OS2](4os2)TCC (formerly 4NT)PowerShellrcBeanShellVMS DCLfish
?
(, , )
(prefix and suffix stripping in variable expansion)
(, , )
(prefix and suffix stripping in variable expansion)
(, , )
(prefix and suffix stripping in variable expansion)
(, , , })()
(:s and other editing operators)
(:s and other editing operators)
(:s and other editing operators + substr, strlen, strindex, printf, reverse, upper, lower, concat and other builtin functions)
{{small(via indefinite directory wildcard{{Citationurl=https://hamiltonlabs.com/UserGuide/31-Wildcarding.htmtitle=Hamilton C shell Language reference: Wildcarding and pattern matchingaccess-date=2013-10-29publisher=Hamilton Laboratories...}} Indefinite Directory: match any number of directory levels – zero or more – whatever it takes to make the rest of the pattern match.}})}}
??
(prefix, suffix stripping and string replacement in variable expansion){{cite bookauthor-last1=Seebachauthor-first1=Petertitle=Beginning Portable Shell Scripting: From Novice to Professionalurl=https://books.google.com/books?id=53zaxy423xcCseries=Expert's voice in open sourcedate=21 November 2008publisher=Apresspublication-date=2008page=149isbn=9781430210436access-date=2014-09-17quote=Brace expansion is available in ksh93, pdksh, bash, and zsh.}}
(, , )(with , no following of symlinks)
?
(through variable processing: e.g. substring extraction, various transformations via parameter expansion)
(, , , extended globbing)( or to follow symlinks)
??
(, )
(, )(only in command)
(only through and )
(, )(only in command)(via command, or, where available, indirectly via subdir option)
(through variable functions , extended environment variable processing, various string commands and and )
(, , , extended wildcards, popup command)(via attribute and description options and size, time, date, and file exclusion ranges)(via command, or indirectly via command or, where available, subdir option)
????
(through variable functions , extended environment variable processing, various string commands and and )
(, , , extended wildcards, popup command)(via attribute and description options and size, time, date, owner, and file exclusion ranges)(via command, or indirectly via command or, where available, subdir option)
(Concat/Substring/Insert/Remove/Replace, ToLower/ToUpper, Trim/TrimStart/TrimEnd, Compare, Contains/StartsWith/EndWith, Format, IndexOf/LastIndexOf, Pad/PadLeft/PadRight, Split/Join, regular expression functions and other .NET string functions){{partialRange operator for numbers{{Cite webtitle = about Operators - PowerShellauthor = sdwheelerwork = docs.microsoft.comdate =access-date = 18 January 2022url = https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operatorsquote =
(full regex support)PowerShell leverages the full .NET regular expression engine which features named captures, zero-width lookahead/-behind, greedy/non-greedy, character classes, level counting etc.
(, , )??
??
?????
(via )
(builtin string function)
(via builtin and functions)
(, , })()

Inter-process communication

ShellPipesCommand substitutionProcess substitutionSubshellsTCP/UDP connections as streamsKeystroke stackingBourne shellPOSIX shellbash (v4.0)cshtcshHamilton C shellScshksh (ksh93t+)pdkshzshashCCPCOMMAND.COMOS/2 CMD.EXEWindows CMD.EXE[4DOS](4dos)[4OS2](4os2)TCC (formerly 4NT)PowerShellrcBeanShellVMS DCLfish
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 tool).
(if system supports or named pipes)
(client only)
?
???
( and })
(if system supports )
(and SCTP support, client only)
(client and server, but only TCP)
(only under DR-DOS multitasker via )
?
(via command)
(Backtick: in )
(via command)?(via and , or via , and and )(via and )
???(via )
(via command)?(via and )(via , , , , , and , client only)(via )
?
{{small(via: {{mono?
????
(spawn)
(server TCP only)
()

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

ShellSecure (password) promptFile/directory passwordsExecute permissionRestricted shell subsetSafe data subsetBourne shellPOSIX shellbash (v4.0)cshtcshHamilton C shellScshksh (ksh93t+)pdkshzshashCCPCOMMAND.COMOS/2 CMD.EXEWindows CMD.EXE[4DOS](4dos)[4OS2](4os2)TCC (formerly 4NT)PowerShellrcBeanShellVMS DCLfish
The shell can use the utility to suppress echoing of typed characters to the screen. This requires multiple steps: 1. reading the current echo state, 2. switching echo off, 3. reading the input, 4. switching echo state back to the original state.?The *execute permission* is enforced by a separate program, the program loader, by refusing to invoke the interpreter (possibly a shell) specified by the script's hashbang. The interpreter does not enforce the execute permission if invoked directly as the program loader would, with the file as an argument; this only requires read permission, as does piping the file as input to the interpreter, in which case the interpreter cannot see the execute permission.
?
?
?
?
?
?
?
?The zsh and fish shells also honor the *execute permission* for command completion.
?
(only under DR-DOS, prompts for password if file/directory is protected)(only under DR-DOS via syntax)Under DR-DOS the password separator for file and directory passwords is a semicolon. This is also supported under 4DOS for as long as the command does not support include lists. Under 4DOS, the password separator must be doubled for all commands supporting include lists in order to distinguish passwords from include lists. Commands not supporting include lists accept both forms. DR-DOS 7.02 and higher optionally accept a doubled semicolon as well, so that doubled semicolons work under both COMMAND.COM and 4DOS regardless of the command executed.(only under DR-DOS, if files are password-protected for read and/or execute permission)DR-DOS supports file passwords for read/write/delete and optionally execute permissions. Files are not protected by default, but the system can be set up so that f.e. batch scripts require a password to read.
(via or ) and echoes back asterisks for each typed character.(only under DR-DOS via syntax)(only under DR-DOS, if files are password-protected for read and/or execute permission)
?
(via , or )
Read-Host -AsSecureString}} reads a string of characters from the input device into an encrypted string, one character at a time thus ensuring that there is no memory image of the clear text which could be gleaned from scanning memory, or from crash dumps, memory dumps, paging files, log files or similar..ps1}} files) are by default associated with the Notepad editor, not with the PowerShell execution engine. Invoking a file will launch Notepad rather than executing the script.Startup scripts per computer/user can import modules and expose a subset the commands/functions available in the modules.
?
?????
??

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.

The shells bash, zsh and PowerShell offer this as a specific feature. 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 external command to switch off/on echoing of input characters. In addition to not echoing back the characters, PowerShell's 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 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 ).

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 was evaluated for the POSIX specification for shells, but not included. However, 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.

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.

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. 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

References

References

  1. A [http://www.collyer.net/who/geoff/v7sh.tar platform independent version] based on the historical UNIX V7 original source code is available from [http://www.collyer.net/who/geoff/ Geoff Collyer]
  2. The historic UNIX V7 version is available under [http://minnie.tuhs.org/Archive/Caldera-license.pdf a BSD-style license] {{Webarchive. link. (2011-08-06 through [[The Unix Heritage Society]] and others.)
  3. A [https://codeberg.org/schilytools/schilytools platform independent version] based on the SVr4/Solaris source code is available from Jörg Schilling
  4. "FreeBSD Quickstart Guide for Linux Users". The FreeBSD Documentation Project.
  5. ["SchilliX-ON / SchilliX-ON Mercurial / b1d9a2] /usr/src/cmd/sh". Sourceforge.net.
  6. [[IEEE]] and The Open Group. (2008). "IEEE 1003.1 Standard for Information Technology – Portable Operating System Interface (POSIX): Shell and Utilities, Issue 7".
  7. As part of IEEE Std.1003.2-1992 (POSIX.2); integrated into IEEE Std.1003.1 with the 2001 revision.
  8. "Advanced Bash-Scripting Guide". The Linux Documentation Project.
  9. "FreeBSD Quickstart Guide for Linux® Users".
  10. [https://docs.oracle.com/cd/E36784_01/html/E36870/ksh-1.html ksh93(1) man page]
  11. [http://www.openbsd.org/faq/faq10.html#rootshell Default shell in OpenBSD] is ksh (pdksh).
  12. The zsh command line editor is fully configurable and can allow mouse support in various ways such as with [http://stchaz.free.fr/mouse.zsh Stéphane Chazelas's {{mono. mouse.zsh].
  13. [http://linux.die.net/man/1/zsh zsh(1) man page and subpages]
  14. [http://linux.die.net/man/1/zshbuiltins zshbuiltins(1) man page]
  15. Lefevre, Vincent. (2015-02-11). "multi-digit file descriptors".
  16. (2015-04-09). "#782228 - busybox sh doesn't support multibyte characters in string handling - Debian Bug report logs". Bugs.debian.org.
  17. "[Z Shell] Completion System". Zsh.sourceforge.io.
  18. This applies only on reserved words and other syntactic features.
  19. e.g. via 3rd party such as [https://github.com/tarruda/zsh-autosuggestions zsh-autosuggestions]
  20. 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]
  21. Shirk, Jason. (15 February 2018). "PSReadLine: A bash inspired readline implementation for PowerShell".
  22. "Windows PowerShell 5.0".
  23. (18 March 2022). "Get-ChildItemColor".
  24. [https://technet.microsoft.com/en-us/library/hh849855.aspx Push-Location] (with alias pushd) and [https://technet.microsoft.com/en-us/library/hh849842.aspx Pop-Location] (with alias popd) allows multiple location types (directories of file systems, organizational units of [[Active Directory]], nodes of [[Windows Registry]] etc) to be pushed onto and popped from location stacks.
  25. "Windows PowerShell Integrated Scripting Environment (ISE)". Microsoft Technet.
  26. The [https://technet.microsoft.com/en-us/library/ff730939.aspx $host.ui.PromptForChoice] function allows for a menu-style prompt for choices. The prompt works from background jobs as well as from remote sessions, displaying the menu prompt on the console of the controlling session.
  27. The [https://technet.microsoft.com/en-us/library/hh849902.aspx {{mono. Write-Progress] cmdlet writes a progress bar which can indicate percentage, remaining seconds etc. The progress bar messages work from background jobs or remote sessions in addition to interactive scripts, i.e. the progress bar is displayed on the console of the controlling session, not as part of the regular output.
  28. The [https://technet.microsoft.com/en-us/library/hh849915.aspx {{mono. Show-Command] cmdlet inspects the command definition and opens an interactive windows with a named input field for each parameter/switch
  29. "fish: Documentation".
  30. "set_color - set the terminal color — fish-shell 3.1.2 documentation".
  31. "abbr - manage fish abbreviations — fish-shell 3.1.2 documentation".
  32. (2013-03-06). "zsh: 20. Completion System". Zsh.sourceforge.io.
  33. sdwheeler. "What's New in the PowerShell 5.0 ISE - PowerShell".
  34. "GitHub - marlonrichert/zsh-autocomplete: 🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.".
  35. "Interactive use — fish-shell 3.3.1 documentation".
  36. Hahn, Harley. (2009). "Harley Hahn's guide to Unix and Linux". McGraw-Hill Higher Education.
  37. "Concurrent DOS 386 - Multiuser/Multitasking Operating System - User Guide". [[Digital Research]].
  38. "pv(1): monitor progress of data through pipe - Linux man page". Linux.die.net.
  39. "fish: Tutorial".
  40. "zsh-users/zsh-syntax-highlighting: Fish shell like syntax highlighting for Zsh".
  41. sdwheeler. "PSReadLine Module - PowerShell".
  42. "Ash Variants".
  43. "Set - Environment Variable - Windows CMD". SS64.com.
  44. "How to loop through array in batch?". Stack Overflow.
  45. The .NET ''System.Math'' class defines mathematical functions that can be used through the shortcut {{mono. [Math], e.g. {{mono. [Math]::Sin for the ''sinus'' function.[https://technet.microsoft.com/en-us/library/dd347632.aspx]
  46. (2009-03-27). "Get closure with GetNewClosure".
  47. "string - manipulate strings — fish-shell 3.1.2 documentation".
  48. Zsh offers a variety of [https://zsh.sourceforge.io/Guide/zshguide05.html#l135 globbing options].
  49. (2002-02-27). "4DOS 8.00 online help".
  50. "find a way to make 'psub --fifo' safe from deadlock · Issue #1040 · fish-shell/fish-shell".
  51. (2010-12-28). "Bash Reference Manual: The Restricted Shell". Gnu.org.
  52. "About Data Sections". Technet.microsoft.com.
  53. "Encrypting Virtual Memory". Center for Information Technology Integration, University of Michigan.
  54. "bash - GNU Bourne-Again SHell".
  55. "Using the Read-Host Cmdlet".
  56. "Linux / Unix Command: stty". Linux.about.com.
  57. "man sh - shell, the standard command language interpreter / posix". Pwet.fr.
  58. "New-PSSessionConfigurationFile". Technet.microsoft.com.
  59. (2007). "Bash cookbook". [[O'Reilly Media]].
  60. (1997-10-02). "Caldera OpenDOS 7.01/7.02 Update Alpha 3 IBMBIO.COM - README.TXT and BOOT.TXT - A short description of how OpenDOS is booted".
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Comparison of command shells — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report