Comparison of command shells
A command shell is a command line interface computer program to an operating system.
General characteristics
Shell | Usual environment | Usually invoked | Introduced | Platform-independent | Default login shell in | Default script shell in | License | Source code availability | User interface | Mouse support | Unicode support | ISO 8601 support | Console redirection | Stream redirection | Configurability | Startup/shutdown scripts | Batch scripts | Logging | 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 | 7th Ed. UNIX | sh | 1977 | Yes[1] | 7th Ed. UNIX | 7th Ed. UNIX, | Proprietary[2] | Yes | Text-based CLI | No | No | N/A | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Yes (.profile) | Yes (Unix feature) | No | Yes |
Bourne shell current version | Various UNIX | sh | 1977 | Yes[3] | SunOS-5.x, FreeBSD (non-root user)[4] | SunOS-5.x | CDDL[5] | Yes | Text-based CLI | No | Yes[6] | N/A | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Yes (.profile) | Yes (Unix feature) | Yes[7] | Yes |
POSIX shell[8] | POSIX | sh | 1992[9] | N/A | N/A | POSIX | N/A | N/A | Text-based CLI | No | Yes, if used by configured locale | N/A | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Unspecified (.profile given as an example) | Yes (Unix feature) | Yes | N/A |
bash (v4) | POSIX | bash, sh | 1989[10] | Yes | GNU, Linux (default for root), Mac OS X 10.3+ | GNU, Linux, Haiku, Mac OS X | GPL | Yes | Text-based CLI | No | Yes[11] | Yes (printf builtin) | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Yes (/etc/profile, .bash_profile, .bash_login, .profile, .bashrc) | Yes (Unix feature) | Yes | Yes |
csh | POSIX | csh | 1978 | Yes | SunOS | ? | BSD | Yes | Text-based CLI | No | No | ? | Yes | Yes (stdin, stdout, stdout+stderr) | Yes (via variables and options) | Yes (~/.cshrc, ~/.login, ~/.logout) | Yes (Unix feature) | Yes | Yes |
tcsh | POSIX | tcsh, csh | 1983[12] | Yes | FreeBSD (default for root), formerly Mac OS X | ? | BSD | Yes | Text-based CLI | No | Yes | ? | Yes | Yes (stdin, stdout, stdout+stderr) | Yes (via variables and options) | Yes (/etc/csh.cshrc, /etc/csh.login, ~/.tcshrc, ~/.cshrc, ~/.history, ~/.login, ~/.cshdirs) | Yes (Unix feature) | Yes | Yes |
Hamilton C shell | Win32, OS/2 | csh | 1988[13] | Yes (OS/2 version no longer maintained) | Optional | Optional | Proprietary | No | Text-based CLI | No | No | Yes (-t timestamp operator) | Yes | Yes (stdin, stdout, stdout+stderr) | Yes (via variables and options) | Yes (via login.csh, startup.csh and logout.csh) | Yes (command line option) | Yes | Yes |
Scsh | POSIX | scsh | 1994 | Yes | ? | ? | BSD-style | Yes | ? | ? | ? | ? | ? | Yes | ? | ? | ? | ? | Yes |
ksh (ksh93t+) | POSIX | ksh | 1983[14][15] | Yes | AIX, HP-UX | OpenSolaris | Common Public License | Yes | Text-based CLI | No | Yes | Yes (printf builtin with %(%F)T[16]) | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Yes (system and user's profile and kshrc) | Yes (Unix feature) | Yes | Yes |
pdksh | POSIX | ksh, sh | 1989? | Yes | OpenBSD[17] | OpenBSD[17] | Public Domain | Yes | Text-based CLI | No | No | N/A | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Yes (/etc/profile, .profile) | Yes (Unix feature) | Yes | Yes |
zsh | POSIX | zsh | 1990 | Yes | Deepin, Gobolinux, Grml | Grml | MIT-style | Yes | Text-based CLI | via additional code[18] | Yes | Yes (various internal features involving the date, by using the %F strftime format[19] and the -i option for the fc builtin[20]) | Yes | Yes (arbitrary fds) | Yes (via variables, options, functions, styles, etc.) | Yes (system and user's zshenv, zprofile, zshrc, zlogin, zlogout) | Yes (Unix feature) | Yes | Yes |
ash | POSIX | sh | 1989 | Yes | Minix, BusyBox based systems | NetBSD, Minix, BusyBox based systems | BSD-style | Yes | Text-based CLI | No | Partial (for BusyBox, supported in command-line editing, but not in string handling[21]) | N/A | Yes | Yes (arbitrary fds) | Yes (via variables and options) | Yes (/etc/profile, .profile) | Yes (Unix feature) | Yes | Yes |
CCP | CP/M, MP/M | (CCP) | 1975 (1973) | No | CP/M (no login), MP/M | CP/M, MP/M | Freeware (originally proprietary) | Yes (originally closed-source) | Text-based CLI | No | No | No | ? | No | No | Yes (automatic via $$$.SUB) | Partial (only via external SUBMIT command to update $$$.SUB) | No | Yes |
COMMAND.COM | DOS | COMMAND | 1980 | No (3rd party implementations, not bound to a specific DOS vendor or version, available) | DOS, Windows 95, 98, SE, ME | DOS, Windows 95, 98, SE, ME | vendor specific, f.e. MS-EULA,[22] 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 COMMAND con: or CTTY con:) | Yes (stdin, stdout) | Yes (via startup parameters and environment variables, DR-DOS also supports DIR /C /R user-default switch command) | Yes (automatic \AUTOEXEC.BAT for primary shell, or explicitly via /P, /P:filename.bat or /K startup options) | Yes (via CALL command or /C and /K startup options) | No | Yes |
OS/2 CMD.EXE | OS/2 | CMD | 1987 | No | OS/2 | OS/2 | IBM-EULA[23] | No | Text-based CLI | No | No | No | No | Yes (stdin, stdout, stderr) | ? | Partial (only via /K startup option) | Yes (via CALL command or /C and /K startup options) | No | ? |
Windows CMD.EXE[24] | Win32 | CMD | 1993 | No | Windows NT, 2000, XP, Server 2003, Vista | Windows NT, 2000, XP, Server 2003, Vista | MS-EULA[25] | No | Text-based CLI | No | Partial (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 /K startup option) | Yes (via CALL command or /C and /K startup options) | No | Yes |
4DOS, NDOS | DOS, Windows 95, 98, SE, ME | 4DOS, NDOS | 1989 (1986) | No (not bound to a specific OS vendor or version) | Optional | Optional | MIT License, with restrictions | Yes | Text-based CLI with TUI extensions | Yes (popups, help system, %_MOUSE internal variable, INKEY /M command) | No | Yes | Yes (via CTTY con:, except for DRAWBOX, DRAWLINE, DRAWVLINE, LIST, SCREEN, SCRPUT, SELECT, VSCRPUT commands and file / directory coloring) | Yes (stdin, stdout, stderr, stdout+stderr) | Yes (via 4DOS.INI/NDOS.INI file, startup parameters, environment variables, SETDOS command) | Yes (automatic \AUTOEXEC.BAT for primary shell and 4START.BTM/4START.BAT as well as 4EXIT.BTM/4EXIT.BAT for any shell, or explicitly via /P, /P:dir\filename.ext or /K startup options) | Yes (via CALL command or /C and /K startup options) | Yes | Yes |
4OS2 | OS/2 | 4OS2 | 1992 | No (not bound to specific OS/2 versions) | Optional | Optional | Freeware | Yes | Text-based CLI | No | No | No | No | Yes (stdin, stdout, stderr, stdout+stderr) | Yes (via 4OS2.INI file, startup parameters, environment variables, SETDOS command) | Yes (automatic via 4START.CMD/4START.BTM as well as 4EXIT.CMD/4EXIT.BTM files, or explicitly via /K startup.cmd option) | Yes (via CALL command or /C and /K startup options) | Yes | ? |
TCC (formerly 4NT) | Win32 | TCC | 1993 | No (not bound to specific NT versions) | optional | optional | Shareware | No | Text-based CLI (Take Command: GUI) | Yes (console mouse, popups, help system, %_XMOUSE, %_YMOUSE internal variables, INKEY /M command) | Yes | Yes | No | Yes (stdin, stdout, stderr, stdout+stderr) | Yes (via registry, TCMD.INI/4NT.INI file, startup parameters, environment variables, SETDOS command) | Yes (automatic via registry and TCSTART/4START as well as TCEXIT/4EXIT, or explicitly via /K startup option) | Yes (via CALL command or /C and /K startup options) | Yes | No |
VMS DCL[26] | OpenVMS | Automatically for login/interactive process | 1977? | Yes | VMS | VMS | Proprietary, bundled in VMS | by special license only | Text-based CLI | with DECwindows/Motif | Yes | Yes, at least to 1988 standard | Yes | Yes (sys$input, sys$output assignment) | Yes (via symbols, logical names, and options) | Yes (SYS$MANAGER:SYLOGIN.COM and user defined LOGIN.COM) | Yes | Yes | No |
PowerShell | .NET | PowerShell | 2006 | Yes | Windows Server 2008, 7, Vista, XP[27] | Windows Server 2008, 7 | MIT-style | Yes | Graphical CLI | Yes | Yes | Yes | No | Yes | Yes (via variables and options) | Yes (%USERPROFILE%\Documents \WindowsPowerShell\Microsoft.PowerShell_profile.ps1) | Yes (PowerShell feature) | Yes | No |
rc | Plan 9, POSIX | rc | 1989 | Yes | Plan 9, Version 10 Unix | Plan 9, Version 10 Unix | Lucent Public License | ? | ? | ? | Yes | ? | ? | Yes | ? | ? | ? | ? | Yes |
BeanShell | Java | ? | 2005 | Yes | ? | ? | LGPL | ? | ? | ? | Yes | ? | ? | Yes | ? | ? | ? | ? | No |
fish | POSIX | fish | 2005[28] | Yes | GhostBSD | ? | GPL | Yes | Text-based CLI | ? | Yes | ? | ? | Yes (arbitrary fds) | Yes (through environment variables and via web interface through fish_config) | Yes (/etc/fish/config.fish and ~/.config/fish/config.fish) | Yes (Unix feature) | Yes (~/.config/fish/fish_history*) | ? |
Shell | Usual environment | Usually invoked | Introduced | Platform-independent | Default login shell in | Default script shell in | License | Source code availability | User interface | Mouse support | Unicode support | ISO 8601 support | Console redirection | Stream redirection | Configurability | Startup/shutdown scripts | Batch scripts | Logging | available as statically linked, independent single file executable |
Interactive features
Shell | Command name completion |
Path completion |
Command argument completion |
Wildcard completion |
Command history |
Mandatory argument prompt |
Automatic suggestions |
Syntax highlighting |
Directory history, stack or similar features | Implicit directory change |
Autocorrection | Integrated environment |
Snippets | Value prompt |
Menu/options prompt |
Progress indicator |
Context sensitive help |
Command builder |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Thompson shell | No | 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 | No | No | No |
Bourne shell current version | No | Yes[29] | No | No | Yes[29] | No | No | No | Yes(CDPATH, pushd, popd, dirs), CDPATH since SVr4 | No | No | No | No | Yes | No | No | No | No |
POSIX shell | No | No | No | No | Yes | No | No | No | Yes (CDPATH) | No | No | No | No | Yes | No | No | No | No |
bash (v4.0) | Yes | Yes | when defined | Yes[30] | Yes | No | No | No | Yes (CDPATH, pushd, popd) | optional | No | No | No | Yes | Yes | No | No | No |
csh | Yes | Yes | No | No | Yes | No | No | No | Yes (cdpath, pushd, popd) | optional | No | No | No | Yes | No | No | No | No |
tcsh | Yes | Yes | when defined | No | Yes | No | No | No | Yes (cdpath, pushd, popd) | optional | Yes | No | No | Yes | No | No | No | No |
Hamilton C shell | Yes | Yes | No | Yes | Yes | No | No | No | Yes (cdpath, pushd, popd) | No | No | No | No | Yes | No | No | No | No |
Scsh | No | No | No | No | No | No | No | No | No | No | No | No | No | Yes | No | No | No | No |
ksh (ksh93t+) | Yes (extendable) | Yes (extendable) | No | No | Yes | No | No | No | Yes (cdpath builtin, pushd, popd implemented as functions) | No | No | No | No | Yes | Yes | No | No | No |
pdksh | Yes | Yes | No | No | Yes | No | No | No | No | No | No | No | No | Yes | Yes | No | No | No |
zsh | Yes | Yes | when defined | Yes[31] | Yes | No | Yes (via predict-on or user-defined[32]) | Third-party extension[33] | Yes | optional | Yes | No | when defined (as ZLE widgets) | Yes | Yes | No | Yes | No |
ash | No | No | No | No | Yes | No | No | No | No | No | No | No | No | Yes | Yes | No | No | No |
CCP | 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[34][35] | No | No | No | No | No | No | No | No | No | No (only via external CHOICE command, in DR-DOS also via SWITCH / DRSWITCH internal commands) | No | No | No |
OS/2 CMD.EXE |
Yes | Yes | No | No | Yes | No | No | No | No | No | No | No | No | No | No | No | No | No |
Windows CMD.EXE |
partial | partial | No | No | Yes (F8) | No | No | No | Yes (PUSHD, POPD) | No | No | No | No | Yes (via SET /P command) | No | No | No | No |
4DOS | Yes | Yes | Yes | Yes | Yes[36][37] | No | No | No | (via popup, extended directory searches, CDPATH, PUSHD, POPD, DIRHISTORY, DIRS, CDD, CD - commands and %@DIRSTACK[] function) | Yes | No | Yes | No | Yes (via INPUT, INKEY and ESET commands) | Yes (via @SELECT[] function, and indirectly via a combination of INKEY, INPUT, SWITCH commands) | No | Yes | No (except for OPTION command for INI file directives) |
4OS2 | ? | ? | ? | ? | Yes | No | No | No | Yes | Yes | No | ? | No | ? | ? | No | Yes | No |
TCC (formerly 4NT) | Yes | Yes | Yes | Yes | Yes | No | No | Yes | (via popup, extended directory searches, CDPATH, PUSHD, POPD, DIRHISTORY, DIRS, CDD, CD - commands and %@DIRSTACK[] function) | Yes | No | Yes | No | Yes (via INPUT, INKEY, ESET and SET /P commands) | Yes (via @SELECT[] function, and indirectly via a combination of INKEY, INPUT, SWITCH commands)[38] | No | Yes | No |
PowerShell | Yes | Yes | Yes | Yes | Yes (F8) | Yes | Yes, in ISE[39] | Yes, in ISE[39] and PSReadLine[40] module(included in v5.0[41]) | Yes; multiple stacks; multiple location types[42] | No | Yes, in PSReadLine[40] module | Yes, in ISE[39] | Yes, in ISE[39] | Yes | Yes[43] | Yes[44] | Yes, in ISE[39] | popup window[45] |
rc | Yes[46] | Yes[46] | No | No | Yes[46] | 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 | No |
VMS DCL | Minimum uniqueness scheme | No | No | No | Yes | Yes | No | No | No | No | No | No | No | Yes | No | No | No | No |
fish | Yes | Yes | when defined or parseable in man pages[47] | Yes[47] | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes[48] | No | Yes | (via fish_config command) | No | No | No |
Shell | Command name completion |
Path completion |
Command argument completion |
Wildcard completion |
Command history |
Mandatory argument prompt |
Automatic suggestions |
Syntax highlighting |
Directory history, stack or similar features | Implicit directory change |
Autocorrection | Integrated environment |
Snippets | Value prompt |
Menu/options prompt |
Progress indicator |
Context sensitive help |
Command builder |
Completions
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 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 suggest completions by calling a shell function.[49] 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
A user of a shell may find that he/she is typing something similar to what the user typed before. If the shell supports command history the user can call the previous command into the line editor and edit it before issuing it again.
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 supports 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 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.
PowerShell allows commands, functions and scripts to define arguments/parameters as mandatory. The shell determines prior to invocation if there is any mandatory arguments/parameters which have not been bound, and will then prompt the user for the value(s) before actual invocation. [50]
Automatic suggestions
With automatic suggestions the shell monitors while the interactive user is typing and displays context-relevant suggestions without interrupting the typing instead of the user explicitly requesting completion.
The PowerShell Integrated Scripting Environment use the discoverable metadata to provide "intellisense" - i.e. suggestions that automatically pops up as the user types, in addition to when the user explicitly requests completion lists by pressing e.g. Tab ↹
Directory history, stack or similar features
A shell may record the locations the user has used as current locations and allow fast switching to any location/directory in the history.
One of the uses of the zsh directory stack is to record a directory history. In particular, the AUTO_PUSHD option and advanced cd arguments and completion are used for this purpose.
PowerShell allows multiple named stacks to be used. Locations (directories) can be pushed onto/popped from the current stack or a named stack. Any stack can become the current (default) stack. Unlike most other shells, PowerShell's location concept allow location stacks to hold file system locations as well as other location types like e.g. Active Directory organizational units/groups, SQL Server databases/tables/objects, Internet Information Server applications/sites/virtual directories.
4DOS and Take Command Console record history of current directories and allows the user to switch to a directory in the history using a popup a window.
Implicit directory change
A directory name can be used directly as a command which implicitly changes the current location to the directory.
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[40] 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.
Integrated environment
An integrated environment is the integration of the command-line interface with editors (typically multiple documents), help system and possibly debugging and other tools.
Take Command Console (TCC) comes with an integrated environment with command line pane, file explorer, editor, batch debugger and more.[51]
PowerShell ISE includes a command line pane with support for integrated command line, copy-paste, multiple document editors, source-level debugging, help pane, command explorer pane and scripting interface allowing scripts/modules to manipulate menus, add-ons etc. The ISE (menus, windows, shortcuts, addons) are customizable through scripts.[52]
Snippets
Snippets are small regions of reusable script code. Snippets are often used to save keystrokes, or to assist the user with common scripting patterns. Many text editors support snippets for scripting either as built-in functionality or through plugins.
PowerShell supports snippets in the Integrated Scripting Environment (ISE) using Ctrl+J.[53]
Value prompt
A shell script can prompt the interactive user for a value.
Menu/options selector
A shell script can present the interactive user with a list of choices.
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".[54] These are not integrated features of the shells, however.
PowerShell has a built-in command and API functions (to be used when authoring commands) for writing/updating a progress bar. Progress bar messages are sent separates from regular command output and the progress bar is always displayed at the ultimate interactive users console regardless of whether the progress messages originates from an interactive script, from a background job or from a remote session.
Interactive table
Output from a command execution can be displayed in a table/grid which can be interactively sorted and filtered and/or otherwise manipulated after command execution ends.
PowerShell Out-GridView cmdlet displays data in an interactive window with interactive sorting and filtering.
Syntax highlighting
An independent project offers syntax highlighting as an add-on to the Z Shell (zsh).[55] This is not part of the shell, however.
PowerShell provides customizable syntax highlighting on the command line through the PSReadLine[40] module. This module can be used with PowerShell v3.0+, and it's included with v5.0. Additionally, it is loaded by default in the command line host "powershell.exe" in v5.0. The PowerShell ISE also includes syntax highlighting on the command line as well as in the script pane.[52] Take Command Console (TCC) offers syntax highlighting in the integrated environment.
Context sensitive help
4DOS, 4OS2, 4NT / Take Command Console and PowerShell (in PowerShell ISE) looks up context-sensitive help information when F1 is pressed.
Zsh provides various forms of configurable context-sensitive help as part of its run-help widget, _complete_help command, or in the completion of options for some commands.
Command builder
A command builder is a guided dialog which assists the user in filling in a command. PowerShell has a command builder which is available in PowerShell ISE or which can be displayed separately through the Show-Command cmdlet.[56]
Programming features
Shell | Functions | Exception handling | Search & replace on variable substitutions | Arithmetic | Floating point | Math function library | Linear arrays or lists | Associative arrays | Lambda functions | eval function | Pseudorandom number generation | Bytecode |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Bourne shell 1977 version | No | Yes (via trap) | No | No | No | No | No | No | No | Yes | No | No |
Bourne shell current version | Yes since SVR2 | Yes (via trap) | No | Yes[29] | No | No | No | No | No | Yes | No | No |
POSIX shell | Yes | Yes (via trap) | No | Yes | No | No | No | No | No | Yes | No | No |
bash (v4.0) | Yes | Yes (via trap) | Yes (via ${//} syntax) | Yes | No | No | Yes | Yes | No | Yes | Yes ($RANDOM) | No |
csh | No | No | Yes (via $var:s/// syntax) | Yes | No | No | Yes | No | No | Yes | No | No |
tcsh | No | No | Yes (via $var:s/// syntax) | Yes | No | No | Yes | No | No | Yes | No | No |
Hamilton C shell | Yes | No | Yes (via $var:s/// syntax) | Yes | Yes | Yes | Yes | No | No | Yes | Yes (random utility) | No |
Scsh | Yes | ? | Yes (via string functions and regular expressions) | ? | ? | ? | Yes | ? | Yes | Yes | Yes (random-integer, random-real) | Yes (compiler is Scheme48 virtual machine, via scshvm) |
ksh (ksh93t+) | Yes | Yes (via trap) | Yes (via ${//} syntax and builtin commands) | Yes | Yes | No | Yes | Yes | No | Yes | Yes ($RANDOM) | Yes (compiler is called shcomp) |
pdksh | Yes | Yes (via trap) | No | Yes | No | No | Yes | No | No | Yes | Yes ($RANDOM) | No |
zsh | Yes | Yes | Yes (via ${:s//} and ${//} syntax) | Yes | Yes | Yes (zsh/mathfunc module) | Yes | Yes | No | Yes | Yes ($RANDOM) | Yes (built-in zcompile command) |
ash | Yes | Yes (via trap) | No | Yes (since 1992)[57] | 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 COMMAND /F (or /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 (via CALL :label) | No | Yes (via SET %varname:expression syntax) | Yes (via SET /A)[58] | No | No | Yes (via SET[59]) | No | No | No | Yes (%random%) | No |
4DOS | Yes | Yes (via ON command, optional Auto-fail via 4DOS /F) | Yes (via %@Replace[…] function) | Yes (via SET /A) | ? | ? | Yes (via ranges, include lists, @file lists and FOR command) | No | No | Yes | Yes (%@Random[…] function) | Yes (via BATCOMP command) |
4OS2 | ? | ? | ? | ? | ? | ? | ? | ? | No | Yes | Yes (%@Random[…] function) | ? |
TCC (formerly 4NT) | Yes | Yes (via ON and various …MONITOR commands) | Yes (via %@Replace[…] function) | Yes (via SET /A) | ? | ? | Yes (via ranges, include lists, @file lists and FOR command) | ? | No | Yes | Yes (%@Random[…] function) | Yes (via BATCOMP command) |
PowerShell | Yes | Yes | Yes (-replace operator) | Yes | Yes | [Math] class[60] | Yes | Yes | Yes | Yes | Yes | Yes, automatic |
rc | Yes | Yes | No | ? | ? | ? | ? | ? | No | Yes | No | No |
BeanShell | Yes | Yes | ? | Yes | ? | ? | Yes | Yes | No | Yes | Yes | Yes |
VMS DCL | Yes | Yes | No | Yes | No | yes, for compiled programs | Yes | No | No | No | No | No |
fish | Yes | Yes (via trap) | No | Optional fish math | Optional fish math | Optional fish math | Yes | No | No | Yes | Yes (random) | No |
- Notes
- ^fish math :The bundled math function requires bc.
String processing and filename matching
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 (**/...) |
csh | Yes (:s and other editing operators) | Yes | No | Yes | No | No |
tcsh | Yes (:s and other editing operators) | Yes | Yes | Yes | No | No |
Hamilton C shell | Yes (:s and other editing operators + substr, strlen, strindex, printf, reverse, upper, lower, concat and other builtin functions) | Yes | No | Yes | No | Yes (via indefinite directory "..." wildcard[61]) |
Scsh | ? | ? | Yes | Yes | No | No |
ksh (ksh93t+) | Partial (prefix, suffix stripping and string replacement in variable expansion) | Yes[62] | Yes | Yes (*, ?, […]) | No | Yes (with set -G, no following of symlinks) |
pdksh | ? | Yes[62] | No | Yes | No | No |
zsh | Yes (through variable processing: e.g. substring extraction, various transformations via parameter expansion) | Yes | Yes | Yes (*, ?, […], extended globbing[63]) | Yes | Yes (**/... or ***/... 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 DIR /A:… command) | No |
Windows CMD.EXE | Partial (only through FOR /F and SET /A) | No | No[64] | Yes (*, ?) | Partial (only in DIR /A:… command) | Yes (via FOR /R command, or, where available, indirectly via /S subdir option) |
4DOS | Yes (through variable functions %@…[], extended environment variable processing, various string commands and FOR /F and SET /A) | No | No | Yes (*, ?, […], extended wildcards, SELECT popup command) | Yes (via /A:… attribute and /I"…" description options and /[S…] size, /[T…] time, /[D…] date, and /[!…] file exclusion ranges) | Yes (via FOR /R command, or indirectly via GLOBAL command or, where available, /S subdir option) |
4OS2 | ? | No | No | ? | ? | ? |
TCC (formerly 4NT) | Yes (through variable functions %@…[], extended environment variable processing, various string commands and FOR /F and SET /A) | No | Yes | Yes (*, ?, […], extended wildcards, SELECT popup command) | Yes (via /A:… attribute and /I"…" description options and /[S…] size, /[T…] time, /[D…] date, /[O…] owner, and /[!…] file exclusion ranges) | Yes (via FOR /R command, or indirectly via GLOBAL command or, where available, /S subdir option) |
PowerShell | Yes (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) | No | Yes (full regex support)[65] | Yes (*, ?, […]) | ? | ? |
rc | ? | ? | No | Yes | No | No |
BeanShell | ? | ? | Yes | ? | ? | ? |
VMS DCL | Yes | No | No | Yes | No | Yes (via [SUBDIR…]) |
fish | No | Yes | No | Yes (*, ?, {…}) | No | Yes (**/...) |
Inter-process communication
Shell | Pipes | Command substitution | Process substitution | Subshells | TCP/UDP connections as streams | Keystroke stacking |
---|---|---|---|---|---|---|
Bourne shell | bytes concurrent | Yes | No | Yes | No | N/A[66] |
POSIX shell | bytes concurrent | Yes | No | Yes | No | N/A[66] |
bash (v4.0) | bytes concurrent | Yes | Yes (if system supports /dev/fd/<n> or named pipes) | Yes | Yes (client only) | N/A[66] |
csh | bytes concurrent | Yes | No | Yes | No | N/A[66] |
tcsh | bytes concurrent | Yes | No | Yes | No | N/A[66] |
Hamilton C shell | bytes concurrent | Yes | No | Yes | No | ? |
Scsh | text | ? | ? | ? | Yes | N/A[66] |
ksh (ksh93t+) | bytes (may contain serialized objects if print -C is used) concurrent | Yes ($(…) and ${<space>…;}) | Yes (if system supports /dev/fd/<n>) | Yes | Yes (and SCTP support, client only) | N/A[66] |
pdksh | bytes concurrent | Yes | No | Yes | No | N/A[66] |
zsh | bytes concurrent | Yes | Yes | Yes | Yes (client and server, but only TCP) | N/A[66] |
ash | bytes concurrent | Yes | No | Yes | No | N/A[66] |
CCP | No | No | No | No | No | No |
COMMAND.COM | text sequential temporary files | No | No | Partial (only under DR-DOS multitasker via COMMAND.COM /T) | No | No |
OS/2 CMD.EXE | text concurrent | No | No | ? | No | No |
Windows CMD.EXE | text concurrent | Yes (via FOR /F command) | No | Yes (Backtick: ` in FOR /F usebackq) | No | No |
4DOS | text sequential temporary files | Yes (via FOR /F command) | ? | Partial (via %@EXECSTR[] and %@EXEC[], or via SET /M, ESET /M and UNSET /M and %@MASTER[…]) | No | Yes (via KEYSTACK and KSTACK)[67] |
4OS2 | text concurrent | ? | ? | ? | No | Yes (via KEYSTACK) |
TCC (formerly 4NT) | text concurrent | Yes (via FOR /F command) | ? | Partial (via %@EXECSTR[] and %@EXEC[]) | Yes (via FTP, TFTP, FTPS, SFTP, HTTP, HTTPS and IFTP, client only) | Yes (via KEYSTACK) |
PowerShell | objects concurrent | Yes | No | Yes | Yes | ? |
rc | text concurrent | Yes | Yes (via: <{cmd} if system supports /dev/fd/<n>) | Yes | No | ? |
BeanShell | not supported | ? | ? | ? | Yes | ? |
VMS DCL | text (via PIPE command) | Yes | No | Yes (spawn) | Yes (server TCP only) | No |
fish | bytes concurrent | Yes (...) | No (broken)[68] | No | No | N/A[66] |
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 an 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
Shell | Secure (password) prompt | Encrypted variables/ parameters | File/directory passwords | Execute permission | Untrusted script blocking | Restricted shell subset | Safe data subset |
---|---|---|---|---|---|---|---|
Bourne shell | via stty[69] | No | ? | N/A[70] | No | Yes | No |
POSIX shell | via stty[69] | No | ? | N/A[70] | No | No | No |
bash (v4.0) | read -s | No | ? | N/A[70] | No | Yes | No |
csh | via stty[69] | No | ? | N/A[70] | No | Yes | No |
tcsh | via stty[69] | No | ? | N/A[70] | No | Yes | No |
Hamilton C shell | No | No | No | No | No | No | No |
Scsh | via stty[69] | No | ? | N/A[70] | No | No | No |
ksh (ksh93t+) | via stty[69] | No | ? | N/A[70] | No | Yes | No |
pdksh | via stty[69] | No | ? | N/A[70] | No | Yes | No |
zsh | read -s | No | ? | N/A[70] | No | Yes | No |
ash | via stty[69] | No | ? | N/A[70] | No | Yes | No |
CCP | No | No | No | No | No | No | No |
COMMAND.COM | Partial (only under DR-DOS, prompts for password if file/directory is protected) | No | Partial (only under DR-DOS via \dirname;dirpwd\filename;filepwd syntax)[71] | Partial (only under DR-DOS, if files are password-protected for read and/or execute permission)[72] | No | No | No |
OS/2 CMD.EXE | No | No | No | No | No | No | No |
Windows CMD.EXE | No | No | No | No | No | No | No |
4DOS | Yes (via INPUT /P or INKEY /P)[73] | No | Partial (only under DR-DOS via \dirname;;dirpwd\filename;;filepwd syntax)[71] | Partial (only under DR-DOS, if files are password-protected for read and/or execute permission)[72] | No | No | No |
4OS2 | ? | No | No | No | No | No | No |
TCC (formerly 4NT) | Yes (via INPUT /P, INKEY /P or QUERYBOX /P)[73] | No | No | No | No | No | No |
PowerShell | Yes[74] | Yes | No | No[75] | Yes[76] | Yes[77] | Yes[78] |
rc | via stty[69] | No | ? | N/A[70] | No | Yes[79] | No |
BeanShell | ? | ? | ? | ? | ? | ? | ? |
VMS DCL | Yes | No | No | Yes | No | Yes | No |
fish | read -s | No | ? | N/A[70] | No | Yes (via fish -l) | ? |
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.[80]
The shells bash, zsh and PowerShell offer this as a specific feature.[81][82] 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 stty external command to switch off/on echoing of input characters.[83] In addition to not echoing back the characters, PowerShell's -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.
Encrypted variables/parameters
If a script reads a password into an environment variable it is in memory in plain text, and thus may be accessed via a core dump. It is also in the process environment, which may be accessible by other processes started by the script.[84]
PowerShell can work with encrypted string variables/parameters.[85] Encrypted variables ensure that values are not inadvertently disclosed through e.g. transcripts, echo'ing, logfiles, memory or crash dumps or even malicious memory scanning. PowerShell also supports saving of such encrypted strings in text files, protected by a key owned by the current user.
Execute permission
Some operating systems define an execute permission which can be granted to users/groups for a file.
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 – System Interfaces Reference, The Single UNIX Specification, Issue 7 from The Open Group).
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.
Untrusted script blocking
Some shells will block scripts determined to be untrustworthy, or refuse to run scripts if mandated by a system administrator.
Script origin execution restriction
PowerShell can be set to block execution of scripts which has been marked as obtained from an unknown/untrusted origin (e.g. the Internet).[86] Internet facing applications such as web browsers, IM clients, mail readers etc. mark files downloaded from the internet with the origin zone in an alternate data stream which is understood by PowerShell.
Signed script restriction
Script/code signing policies can be used to ensure that an operations department only run approved scripts/code which have been reviewed and signed by a trusted reviewer/approver. Signing regimes also protects against tampering. If a script is sent from vendor to a client, the client can use signing to ensure that the script has not been tampered with during transit and that the script indeed originates from the vendor and not an attacker trying to social engineer an operator into running an attack script.
PowerShell can be set to allow execution of otherwise blocked scripts (e.g. originating from an untrusted zone) if the script has been digitally signed using a trusted digital certificate.[87][88][89]
Multilevel execution policies
A company may want to enforce execution restriction globally within the company and/or certain parts of the company. It may want to set a policy for running signed scripts but allow certain parts of the company to set their own policies for zoned restrictions.
PowerShell allows script blocking policies to be enforced at multiple levels: Local machine, current user etc. A higher level policy overrides a lower level policy, e.g. if a policy is defined for the local machine it is in place for all users of the local machine, only if it is left undefined at the higher level can it be defined for the lower levels.
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.[90][91]
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.[92]
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.[93] 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.
PowerShell data sections can contain constants and expressions using a restricted subset of operators and commands.[94] PowerShell data sections are used when e.g. localized strings needs to be read from an external source while protecting against unwanted side effects.
References
- ↑ A platform independent version based on the historical UNIX V7 original source code is available from Geoff Collyer
- ↑ The historic UNIX V7 version is available under a BSD-style license through the Unix Heritage Society and others.
- ↑ A platform independent version based on the SVr4/Solaris source code is available from Jörg Schilling
- ↑ Ferrell, John, "Chapter 2. Default Shell", FreeBSD Quickstart Guide for Linux Users, The FreeBSD Documentation Project, retrieved 2015-07-24
- ↑ "SchilliX-ON / SchilliX-ON Mercurial / [b1d9a2] /usr/src/cmd/sh". Sourceforge.net. Retrieved 2015-07-02.
- ↑ Since mid 1990s
- ↑ if compiled with -DACCT
- ↑ IEEE and The Open Group (2008). IEEE 1003.1 Standard for Information Technology – Portable Operating System Interface (POSIX): Shell and Utilities, Issue 7.
- ↑ As part of IEEE Std.1003.2-1992 (POSIX.2); integrated into IEEE Std.1003.1 with the 2001 revision.
- ↑ Fox, Brian (1989-06-07). Tower Jr., Leonard H., ed. "Bash is in beta release!". Newsgroup: gnu.announce. Usenet: 8906080235.AA01983@wheat-chex.ai.mit.edu. Retrieved 2010-10-28.
- ↑ Cooper, Mendel, "Chapter 37.3.2. Bash, version 4.2", Advanced Bash-Scripting Guide, The Linux Documentation Project, retrieved 2015-04-30, "Bash now supports the \u and \U Unicode escape."
- ↑ Greer, Ken (1983-10-03). "C shell with command and filename recognition/completion". Newsgroup: net.sources. Retrieved 2010-12-29.
- ↑ Sussman, Ann (1988-12-26). "Hamilton C Shell Speeds Development Of OS/2 Applications" (PDF). PC Week (Dec 26 1988 - Jan 2 1989): 37. Retrieved 2010-11-22.
- ↑ Gomes, Ron (1983-06-09). "Toronto USENIX Conference Schedule (tentative)". Newsgroup: net.usenix. Retrieved 2010-12-29.
- ↑ Harris, Guy (1983-10-10). "csh question". Newsgroup: net.flame. Retrieved 2010-12-29.
- ↑ ksh93(1) man page
- 1 2 Default shell in OpenBSD is ksh (pdksh).
- ↑ The zsh command line editor is fully configurable and can allow mouse support in various ways such as with Stéphane Chazelas's mouse.zsh.
- ↑ zsh(1) man page and subpages
- ↑ zshbuiltins(1) man page
- ↑ "#782228 - busybox sh doesn't support multibyte characters in string handling - Debian Bug report logs". Bugs.debian.org. 2015-04-09. Retrieved 2015-07-02.
- ↑ MS-DOS and Windows component – covered by a valid license for MS-DOS or Microsoft Windows
- ↑ OS/2 component – covered by a valid license for OS/2
- ↑ Command extensions enabled, or "CMD /X".
- ↑ Windows component – covered by a valid license for Microsoft Windows
- ↑ "HP OpenVMS DCL Dictionary". Retrieved 2009-03-23.
- ↑ Windows PowerShell is installed with Windows 7, however, it is an optional download for users of Windows Vista or Windows XP.
- ↑ Liljencrantz, Axel (2005-05-17). "Fish - The friendly interactive shell". Retrieved 2013-04-08.
- 1 2 3 current versions from Jörg Schilling
- ↑ Alt-Shift-8 or Alt-* will expand to the full matching list of filenames
- ↑ "[Z Shell] Completion System". Zsh.sourceforge.net. Retrieved 2015-02-24.
- ↑ e.g. via 3rd party such as zsh-autosuggestions
- ↑ zsh does not feature syntax highlighting, but a 3rd party project exists which offers this capability as an add-on: zsh-syntax-highlighting
- ↑ Available through the DOSKEY add-on
- ↑ Available in DR-DOS through HISTORY
- ↑ Alternatively available through the DOSKEY add-on as well
- ↑ Alternatively available in DR-DOS through HISTORY as well
- ↑ TCC has special prompt functions for Yes, No, Cancel, Close, Retry.
- 1 2 3 4 5 "Windows PowerShell Integrated Scripting Environment (ISE)". Microsoft Technet. Retrieved 2015-09-12.
- 1 2 3 4
- ↑
- ↑ Push-Location (with alias
pushd
) and Pop-Location (with aliaspopd
) 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. - ↑ The $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.
- ↑ The 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.
- ↑ The Show-Command cmdlet inspects the command definition and opens an interactive windows with a named input field for each parameter/switch
- 1 2 3 Handled by rio, GNU readline, editline or vrl
- 1 2 "fish: Documentation". Section Tab completion. Retrieved 2016-01-10.
- ↑ The fish shell is an interactive character based input/output surface
- ↑ "zsh: 20. Completion System". Zsh.sourceforge.net. 2013-03-06. Retrieved 2013-08-18.
- ↑ "Use PowerShell to Make Mandatory Parameters". Blogs.technet.com. Retrieved 2015-02-24.
- ↑ "#1 Windows Command Line Replacement - Windows CMD Command Prompt Commands". JP Software. Retrieved 2013-08-18.
- 1 2 "Windows PowerShell 3.0 Integrated Scripting Environment (ISE)". Technet.microsoft.com. Retrieved 2013-08-18.
- ↑ "PowerShell v3 ISE and ISE scripting model changes & improvements". PowerShell Magazine. 2011-09-28. Retrieved 2013-08-18.
- ↑ "pv(1): monitor progress of data through pipe - Linux man page". Linux.die.net. Retrieved 2015-02-24.
- ↑ "zsh-users/zsh-syntax-highlighting 路 GitHub". Github.com. Retrieved 2013-08-18.
- ↑ "Show-Command". Technet.microsoft.com. Retrieved 2013-08-18.
- ↑ Ash Variants
- ↑ "Set - Environment Variable | Windows CMD". SS64.com. Retrieved 2015-02-24.
- ↑ "How to loop through array in batch?". Stack Overflow. Retrieved 2015-02-24.
- ↑ The .NET System.Math class defines mathematical functions that can be used through the shortcut [Math], e.g. [Math]::Sin for the sinus function.
- ↑ Hamilton C shell Language reference: Wildcarding and pattern matching, Hamilton Laboratories, retrieved 2013-10-29,
... Indefinite Directory: match any number of directory levels – zero or more – whatever it takes to make the rest of the pattern match.
- 1 2 Seebach, Peter (2008). Beginning Portable Shell Scripting: From Novice to Professional. Expert's voice in open source. Apress. p. 149. ISBN 9781430210436. Retrieved 2014-09-17.
Brace expansion is available in ksh93, pdksh, bash, and zsh.
- ↑ Zsh offers a variety of globbing options.
- ↑ Not available as a shell built-in. External FINDSTR /R command is available in most Windows releases.
- ↑ PowerShell leverages the full .NET regular expression engine which features named captures, zero-width lookahead/-behind, greedy/non-greedy, character classes, level counting etc.
- 1 2 3 4 5 6 7 8 9 10 11 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 expect tool).
- ↑ Brothers, Hardin; Rawson, Tom; Conn, Rex C.; Paul, Matthias; Dye, Charles E.; Georgiev, Luchezar I. (2002-02-27). 4DOS 8.00 online help.
- ↑ https://github.com/fish-shell/fish-shell/issues/1040
- 1 2 3 4 5 6 7 8 9 The shell can use the stty 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.
- 1 2 3 4 5 6 7 8 9 10 11 12 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.
- 1 2 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.
- 1 2 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.
- 1 2 INPUT /P and INKEY /P echoes back asterisks for each typed character
- ↑ 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.
- ↑ PowerShell script files (.ps1 files) are by default associated with the Notepad editor, not with the PowerShell execution engine. Invoking a .ps1 file will launch Notepad rather than executing the script.
- ↑ "About Execution Policies". Technet.microsoft.com. Retrieved 2015-02-24.
- ↑ Startup scripts per computer/user can import modules and expose a subset the commands/functions available in the modules.
- ↑ "About Data Sections". Technet.microsoft.com. Retrieved 2015-02-24.
- ↑ "Ubuntu Manpage: rc - shell". Manpages.ubuntu.com. 2003-07-17. Retrieved 2015-02-24.
- ↑ Provos, Niels. "Encrypting Virtual Memory". Center for Information Technology Integration, University of Michigan. Retrieved 2012-12-20.
- ↑ "bash - GNU Bourne-Again SHell".
read -s Silent mode. If input is coming from a terminal, characters are not echoed.
- ↑ "Using the Read-Host Cmdlet".
By adding the -assecurestring parameter you can mask the data entered at the prompt
- ↑ "Linux / Unix Command: stty". Linux.about.com. Retrieved 2015-02-24.
- ↑ Albing, Carl; Vossen, J. P.; Newham, Cameron (2007). "3.8. Prompting for a Password". Bash cookbook (1st ed.). Sebastopol, California: O'Reilly Media. p. 65. ISBN 978-0-596-52678-8.
Be aware that if you read a password into an environment variable it is in memory in plain text, and thus may be accessed via a core dump or /proc/core. It is also in the process environment, which may be accessible by other processes.
- ↑ Holmes, Lee. "SecureStrings in PowerShell". Retrieved 2012-12-18.
- ↑ "PowerShell Security :: Windows OS Security :: Articles & Tutorials". WindowSecurity.com. Retrieved 2013-08-18.
- ↑ "Signing PowerShell Scripts". Hanselman.com. Retrieved 2015-12-24.
- ↑ "Hey, Scripting Guy! How Can I Sign Windows PowerShell Scripts with an Enterprise Windows PKI? (Part 2 of 2) - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs". Blogs.technet.com. Retrieved 2013-08-18.
- ↑ "Running Windows PowerShell Scripts". Technet.microsoft.com. Retrieved 2013-08-18.
- ↑ "man sh - shell, the standard command language interpreter / posix" (in French). Pwet.fr. Retrieved 2013-08-18.
- ↑ "Bash Reference Manual: The Restricted Shell". Gnu.org. 2010-12-28. Retrieved 2013-08-18.
- ↑ "New-PSSessionConfigurationFile". Technet.microsoft.com. Retrieved 2013-08-18.
- ↑ Albing, Carl; Vossen, J. P.; Newham, Cameron (2007). Bash cookbook (1st ed.). Sebastopol, California, USA: O'Reilly Media. ISBN 978-0-596-52678-8.
[…] 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.
- ↑ "About Data Sections". Microsoft. Retrieved 2012-12-18.
External links
- Linux Magazine: Bash vs. Vista PowerShell
- IEEE. 1003.1 Standard for Information Technology – Portable Operating System Interface (POSIX): Shell and Utilities, Issue 7