词条 | Comparison of command shells | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
释义 |
A command shell is a command line interface computer program to an operating system. General characteristics
Interactive features
Background executionBackground execution allows a shell to run a command in background. POSIX shells and other Unix shells allow background execution by using the & character and the end of command, and in PowerShell you can use Completions{{main article|Command-line completion}}Completion features assist the user in typing commands at the command line, by looking for and suggesting matching words for incomplete ones. Completion is generally requested by pressing the completion key (often the {{keypress|TAB}} key). Command name completion is the completion of the name of a command. In most shells, a command can be a program in the command path (usually Path 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{{main article|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 support completion from history rather than just recalling commands from the history. In addition to the plain command text, PowerShell also records execution start- and end time and execution status in the command history. Mandatory argument prompt{{further|Named parameter#Optional_parameters}}Mandatory arguments/parameters are arguments/parameters which must be assigned a value upon invocation of the command, function or script file. A shell that can determine ahead of invocation that there are missing mandatory values, can assist the interactive user by prompting for those values instead of letting the command fail. Having the shell prompt for missing values will allow the author of a script, command or function to mark a parameter as mandatory instead of creating script code to either prompt for the missing values (after determining that it is being run interactively) or fail with a message. 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{{main article|Autocomplete}}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. {{keypress|tab}} {{further|Intellisense}}Directory history, stack or similar featuresA 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 changeA directory name can be used directly as a command which implicitly changes the current location to the directory. AutocorrectionWhen 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[39] 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{{main article|Integrated development environment}}{{see also|Integrated applications environment|File manager}}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{{main article|Snippet (programming)}}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 {{keypress|Ctrl|J}}.[53] Value promptA shell script can prompt the interactive user for a value. Menu/options selectorA shell script can present the interactive user with a list of choices. Progress indicatorA 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 tableOutput 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{{main article|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[39] 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{{main article|Context-sensitive help}}4DOS, 4OS2, 4NT / Take Command Console and PowerShell (in PowerShell ISE) looks up context-sensitive help information when {{keypress|F1}} is pressed. Zsh provides various forms of configurable context-sensitive help as part of its run-help widget, _complete_help command, or in the completion of options for some commands. Command builderA 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
{{note|fishmath|fish math}}:The bundled math function requires bc. String processing and filename matching
Inter-process communication
Keystroke stackingIn 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{{importance section|date=July 2014}}
Secure promptSome 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/parametersIf 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 permissionSome 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{{Snd}} this also goes for shells and other interpreter programs. The behaviour is mandated by the POSIX C library that is used for interfacing with the kernel. POSIX specifies that the 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 blockingSome shells will block scripts determined to be untrustworthy, or refuse to run scripts if mandated by a system administrator. Script origin execution restrictionPowerShell 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 restrictionScript/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 policiesA 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 subsetSeveral 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 subsetScripts 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 [https://technet.microsoft.com/en-us/library/hh848302.aspx 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. References1. ^A platform independent version based on the historical UNIX V7 original source code is available from Geoff Collyer 2. ^The historic UNIX V7 version is available under a BSD-style license through the Unix Heritage Society and others. 3. ^A [https://sourceforge.net/projects/schilytools/files/ platform independent version] based on the SVr4/Solaris source code is available from Jörg Schilling 4. ^{{citation |url=https://www.freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/index.html |chapter-url=https://www.freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/shells.html |title=FreeBSD Quickstart Guide for Linux Users |chapter=Chapter 2. Default Shell |author-first=John |author-last=Ferrell |publisher=The FreeBSD Documentation Project |access-date=2015-07-24}} 5. ^{{cite web |url=https://sourceforge.net/p/schillix-on/schillix-on/ci/default/tree/usr/src/cmd/sh/ |title=SchilliX-ON / SchilliX-ON Mercurial / [b1d9a2] /usr/src/cmd/sh |publisher=Sourceforge.net |access-date=2015-07-02}} 6. ^Since mid 1990s 7. ^if compiled with -DACCT 8. ^{{cite book |author=IEEE and The Open Group |title=IEEE 1003.1 Standard for Information Technology – Portable Operating System Interface (POSIX): Shell and Utilities, Issue 7 |date=2008}} 9. ^As part of IEEE Std.1003.2-1992 (POSIX.2); integrated into IEEE Std.1003.1 with the 2001 revision. 10. ^{{Cite newsgroup|title=Bash is in beta release!|author-first=Brian|author-last=Fox|editor-first=Leonard H.|editor-last=Tower Jr.|date=1989-06-07|newsgroup=gnu.announce|message-id=8906080235.AA01983@wheat-chex.ai.mit.edu|url=https://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=en|access-date=2010-10-28}} 11. ^{{citation |url=http://tldp.org/LDP/abs/html/bashver4.html |title=Advanced Bash-Scripting Guide |chapter=Chapter 37.3.2. Bash, version 4.2 |author-first=Mendel |author-last=Cooper |publisher=The Linux Documentation Project |access-date=2015-04-30}}, "Bash now supports the \\u and \\U Unicode escape." 12. ^{{Cite newsgroup|author-first=Ken|author-last=Greer|title=C shell with command and filename recognition/completion|date=1983-10-03|newsgroup=net.sources|url=https://groups.google.com/group/net.sources/msg/7073bf41cc5da330?hl=en|access-date=2010-12-29}} 13. ^{{cite journal|author-last=Sussman|author-first=Ann|title=Hamilton C Shell Speeds Development Of OS/2 Applications|journal=PC Week|date=1988-12-26|issue=Dec 26 1988 - Jan 2 1989|page=37|url=https://hamiltonlabs.com/archives/Hamilton-C-Shell-Speeds-Development-of-OS-2-Applications-Ann-Sussman-PC-Week-Dec-26-1988.pdf|access-date=2010-11-22}} 14. ^{{Cite newsgroup|author-first=Ron|author-last=Gomes|title=Toronto USENIX Conference Schedule (tentative)|date=1983-06-09|newsgroup=net.usenix|url=https://groups.google.com/group/net.usenix/msg/fa6e1f7de3b63bba?hl=en|access-date=2010-12-29}} 15. ^{{Cite newsgroup|author-first=Guy|author-last=Harris|title=csh question|date=1983-10-10|newsgroup=net.flame|url=https://groups.google.com/group/net.flame/msg/4f868085b65af530?hl=en|access-date=2010-12-29}} 16. ^ksh93(1) man page 17. ^1 Default shell in OpenBSD is ksh (pdksh). 18. ^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. 19. ^zsh(1) man page and subpages 20. ^zshbuiltins(1) man page 21. ^{{cite web |url=https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782228 |title=#782228 - busybox sh doesn't support multibyte characters in string handling - Debian Bug report logs |publisher=Bugs.debian.org |date=2015-04-09 |access-date=2015-07-02}} 22. ^MS-DOS and Windows component – covered by a valid license for MS-DOS or Microsoft Windows 23. ^OS/2 component – covered by a valid license for OS/2 24. ^Command extensions enabled, or "CMD /X". 25. ^Windows component – covered by a valid license for Microsoft Windows 26. ^{{cite web|url=http://h71000.www7.hp.com/doc/732final/9996/9996pro_contents.html|title=HP OpenVMS DCL Dictionary|access-date=2009-03-23}} 27. ^Windows PowerShell is installed with Windows 7, however, it is an optional download for users of Windows Vista or Windows XP. 28. ^{{cite web|title=Fish - The friendly interactive shell|author-first=Axel|author-last=Liljencrantz|date=2005-05-17|url=https://lwn.net/Articles/136232/|access-date=2013-04-08}} 29. ^1 2 current versions from Jörg Schilling 30. ^Alt-Shift-8 or Alt-* will expand to the full matching list of filenames 31. ^{{cite web |title=[Z Shell] Completion System |url=http://zsh.sourceforge.net/Doc/Release/Completion-System.html |publisher=Zsh.sourceforge.net |access-date=2015-02-24}} 32. ^e.g. via 3rd party such as [https://github.com/tarruda/zsh-autosuggestions zsh-autosuggestions] 33. ^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] 34. ^Available through the DOSKEY add-on 35. ^Available in DR-DOS through HISTORY 36. ^Alternatively available through the DOSKEY add-on as well 37. ^Alternatively available in DR-DOS through HISTORY as well 38. ^TCC has special prompt functions for Yes, No, Cancel, Close, Retry. 39. ^1 2 3 {{cite web|url=https://github.com/lzybkr/PSReadLine]|title=PSReadLine: A bash inspired readline implementation for PowerShell|first=Jason|last=Shirk|date=15 February 2018|publisher=|via=GitHub}} 40. ^{{Cite web |url=https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/core-modules/windows-powershell-5.0 |title=Archived copy |access-date=8 September 2016 |archive-url=https://web.archive.org/web/20160917093943/https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/core-modules/windows-powershell-5.0 |archive-date=17 September 2016 |dead-url=yes |df=dmy-all }} 41. ^[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.42. ^1 2 3 4 {{cite web |title=Windows PowerShell Integrated Scripting Environment (ISE) |url=https://technet.microsoft.com/en-us/library/dd819514.aspx?f=255&MSPPError=-2147217396 |publisher=Microsoft Technet |access-date=2015-09-12}} 43. ^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. 44. ^The [https://technet.microsoft.com/en-us/library/hh849902.aspx 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. 45. ^The [https://technet.microsoft.com/en-us/library/hh849915.aspx Show-Command] cmdlet inspects the command definition and opens an interactive windows with a named input field for each parameter/switch 46. ^1 2 Handled by rio, GNU readline, editline or vrl 47. ^1 {{cite web |url=http://fishshell.com/docs/current/index.html#completion |title=fish: Documentation |at=Section Tab completion |access-date=2016-01-10}} 48. ^The fish shell is an interactive character based input/output surface 49. ^{{cite web |url=http://zsh.sourceforge.net/Doc/Release/Completion-System.html |title=zsh: 20. Completion System |publisher=Zsh.sourceforge.net |date=2013-03-06 |accessdate=2013-08-18}} 50. ^{{cite web |title=Use PowerShell to Make Mandatory Parameters |url=http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/22/use-powershell-to-make-mandatory-parameters.aspx |publisher=Blogs.technet.com |access-date=2015-02-24}} 51. ^{{cite web |url=http://jpsoft.com/take-command-windows-scripting.html |title=#1 Windows Command Line Replacement - Windows CMD Command Prompt Commands |publisher=JP Software |access-date=2013-08-18}} 52. ^1 {{cite web |url=https://technet.microsoft.com/en-us/library/hh849182.aspx |title=Windows PowerShell 3.0 Integrated Scripting Environment (ISE) |publisher=Technet.microsoft.com |access-date=2013-08-18}} 53. ^{{cite web |url=http://www.powershellmagazine.com/2011/09/28/powershell-v3-ise-and-ise-scripting-model-changes-improvements/ |title=PowerShell v3 ISE and ISE scripting model changes & improvements |publisher=PowerShell Magazine |date=2011-09-28 |access-date=2013-08-18}} 54. ^{{cite web |url=http://linux.die.net/man/1/pv |title=pv(1): monitor progress of data through pipe - Linux man page |publisher=Linux.die.net |access-date=2015-02-24}} 55. ^{{cite web |url=https://github.com/zsh-users/zsh-syntax-highlighting |title=zsh-users/zsh-syntax-highlighting: Fish shell like syntax highlighting for Zsh |website=GitHub |access-date=2013-08-18}} 56. ^{{cite web |url=https://technet.microsoft.com/en-us/library/hh849915.aspx |title=Show-Command |publisher=Technet.microsoft.com |access-date=2013-08-18}} 57. ^Ash Variants 58. ^{{cite web |url=https://ss64.com/nt/set.html |title=Set - Environment Variable | Windows CMD |publisher=SS64.com |access-date=2015-02-24}} 59. ^{{cite web |url=https://stackoverflow.com/questions/18462169/how-to-loop-through-array-in-batch |title=How to loop through array in batch? |publisher=Stack Overflow |access-date=2015-02-24}} 60. ^The .NET System.Math class defines mathematical functions that can be used through the shortcut [Math], e.g. [Math]::Sin for the sinus function.[https://technet.microsoft.com/en-us/library/dd347632.aspx] 61. ^{{Citation|url=https://hamiltonlabs.com/UserGuide/31-Wildcarding.htm|title=Hamilton C shell Language reference: Wildcarding and pattern matching|access-date=2013-10-29|publisher=Hamilton Laboratories|quote=... Indefinite Directory: match any number of directory levels – zero or more – whatever it takes to make the rest of the pattern match.}} 62. ^1 {{cite book|author-last1=Seebach|author-first1=Peter|title=Beginning Portable Shell Scripting: From Novice to Professional|url=https://books.google.com/books?id=53zaxy423xcC|series=Expert's voice in open source|publisher=Apress|publication-date=2008|page=149|isbn=9781430210436|access-date=2014-09-17|quote=Brace expansion is available in ksh93, pdksh, bash, and zsh.}} 63. ^Zsh offers a variety of globbing options. 64. ^Not available as a shell built-in. External FINDSTR /R command is available in most Windows releases. 65. ^PowerShell leverages the full .NET regular expression engine which features named captures, zero-width lookahead/-behind, greedy/non-greedy, character classes, level counting etc. 66. ^1 2 3 4 5 6 7 8 9 10 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). 67. ^{{cite book |title=4DOS 8.00 online help |author-first1=Hardin |author-last1=Brothers |author-first2=Tom |author-last2=Rawson |author-first3=Rex C. |author-last3=Conn |author-first4=Matthias |author-last4=Paul |author-first5=Charles E. |author-last5=Dye |author-first6=Luchezar I. |author-last6=Georgiev |date=2002-02-27}} 68. ^{{cite web|url=https://github.com/fish-shell/fish-shell/issues/1040|title=find a way to make `psub --fifo` safe from deadlock · Issue #1040 · fish-shell/fish-shell|website=GitHub}} 69. ^1 2 3 4 5 6 7 8 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. 70. ^1 2 3 4 5 6 7 8 9 10 11 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. 71. ^1 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. 72. ^1 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. 73. ^1 INPUT /P and INKEY /P echoes back asterisks for each typed character 74. ^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. 75. ^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. 76. ^{{cite web |url=https://technet.microsoft.com/en-us/library/hh847748.aspx |title=About Execution Policies |publisher=Technet.microsoft.com |access-date=2015-02-24}} 77. ^Startup scripts per computer/user can import modules and expose a subset the commands/functions available in the modules. 78. ^{{cite web |url=https://technet.microsoft.com/en-us/library/hh848302.aspx |title=About Data Sections |publisher=Technet.microsoft.com |access-date=2015-02-24}} 79. ^{{cite web |url=http://manpages.ubuntu.com/manpages/precise/man1/rc.1.html |title=Ubuntu Manpage: rc - shell |publisher=Manpages.ubuntu.com |date=2003-07-17 |access-date=2015-02-24}} 80. ^{{cite web |author-last=Provos |author-first=Niels |title=Encrypting Virtual Memory |url=http://www.openbsd.org/papers/swapencrypt.ps |publisher=Center for Information Technology Integration, University of Michigan |access-date=2012-12-20}} 81. ^{{cite web |url=https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html |title=bash - GNU Bourne-Again SHell |quote=read -s Silent mode. If input is coming from a terminal, characters are not echoed.}} 82. ^{{cite web |url=https://technet.microsoft.com/en-us/library/ee176935.aspx |title=Using the Read-Host Cmdlet |quote=By adding the -assecurestring parameter you can mask the data entered at the prompt}} 83. ^{{cite web |title=Linux / Unix Command: stty |url=http://linux.about.com/od/commands/l/blcmdl1_stty.htm |publisher=Linux.about.com |access-date=2015-02-24}} 84. ^{{cite book |author-last1=Albing |author-first1=Carl |title=Bash cookbook |year=2007 |publisher=O'Reilly Media |location=Sebastopol, California |isbn=978-0-596-52678-8 |edition=1st |author-last2=Vossen |author-first2=J. P. |author-last3=Newham |author-first3=Cameron |page=65 |chapter=3.8. Prompting for a Password |quote=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.}} 85. ^{{cite web |author-last=Holmes |author-first=Lee |title=SecureStrings in PowerShell |url=http://www.leeholmes.com/blog/2006/06/01/securestrings-in-powershell/ |access-date=2012-12-18}} 86. ^{{cite web |url=http://www.windowsecurity.com/articles/PowerShell-Security.html |title=PowerShell Security :: Windows OS Security :: Articles & Tutorials |publisher=WindowSecurity.com |access-date=2013-08-18}} 87. ^{{cite web |url=http://www.hanselman.com/blog/SigningPowerShellScripts.aspx |title=Signing PowerShell Scripts |publisher=Hanselman.com |access-date=2015-12-24}} 88. ^{{cite web |url=http://blogs.technet.com/b/heyscriptingguy/archive/2010/06/17/hey-scripting-guy-how-can-i-sign-windows-powershell-scripts-with-an-enterprise-windows-pki-part-2-of-2.aspx |title=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 |publisher=Blogs.technet.com |access-date=2013-08-18}} 89. ^{{cite web |url=https://technet.microsoft.com/en-us/library/ee176949.aspx |title=Running Windows PowerShell Scripts |publisher=Technet.microsoft.com |access-date=2013-08-18}} 90. ^{{cite web |url=http://pwet.fr/man/linux/commandes/posix/sh |title=man sh - shell, the standard command language interpreter / posix |language=French |publisher=Pwet.fr |access-date=2013-08-18}} 91. ^{{cite web |url=https://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell.html |title=Bash Reference Manual: The Restricted Shell |publisher=Gnu.org |date=2010-12-28 |access-date=2013-08-18}} 92. ^{{cite web |url=https://technet.microsoft.com/en-us/library/hh849712.aspx |title=New-PSSessionConfigurationFile |publisher=Technet.microsoft.com |access-date=2013-08-18}} 93. ^{{cite book |author-last1=Albing |author-first1=Carl |title=Bash cookbook |year=2007 |publisher=O'Reilly Media |location=Sebastopol, California, USA |isbn=978-0-596-52678-8 |edition=1st |author-last2=Vossen |author-first2=J. P. |author-last3=Newham |author-first3=Cameron |quote=[…] is hardly what one thinks of as a passive list of configured variables. It can run other commands (e.g., cat) and use if statements to vary its choices. It even ends by echoing a message. Be careful when you source something, as it's a wide open door into your script.}} 94. ^{{cite web |title=About Data Sections |url=https://technet.microsoft.com/en-us/library/hh848302.aspx |publisher=Microsoft |access-date=2012-12-18}} External links
2 : Command shells|Software comparisons |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。