Shell built-in command Shopt this built-in command changes the optional behavior of the extra shell. Shoptshopt [-pqsu] [-o] [optname & hellip;] switches the values of variables used to control various optional shell behaviors. If the option is not included or the-p option is used, the system displays the shell built-in command Shopt for all the options that can be set. This built-in command changes the optional behavior of the extra shell. Shopt [-pqsu] [-o] [optname…] Switches the values of variables used to control various optional shell behaviors. If the option is not included or the-p option is used, the list of all the options that can be set is displayed, and whether the option is set. -P options display output in the form of reusable input. Other options have the following meanings:-s enables each optname. (Set)-u close each optname. (Unset)-q: whether to enable optname. If you have the-q option and multiple optname parameters, if all optnames are enabled, the return value is zero. Otherwise, a non-zero value is returned. -O limits the value of optname. you can only use the value defined by the-o option of the built-in command set. (See the built-in command set) if you use-s or-u without the optname parameter, the range of displayed results is limited to the options that are enabled or disabled. Unless otherwise specified, the shopt option is disabled by default. When listing options, if all optnames are enabled, the return value is 0, otherwise it is a non-zero value. When setting or canceling the option, the returned status is zero unless an optname is not a valid shell option. The shopt option list is as follows: if autocd is set, the name of a directory is executed as a parameter of the cd command. This option is only used in interactive shell. If cdable_vars is set, the built-in command cd is not a parameter of the directory name and is treated as a variable name. The value of this variable is the directory to be switched. If cdspell is set, small spelling errors in the directory section of the cd command will be corrected. These errors include reversed characters, missing characters, and extra characters. If the corrected result can be found, the corrected path is printed and the command is executed. This option is only used for interactive shell. If checkhash is set, Bash checks whether the command exists in the hash table before executing the command. If the hash table does not exist, a normal path search is executed. If checkjobs is set, Bash lists the statuses of all stopped and running jobs before exiting the interactive shell. If any job is running, this will delay the exit time until the second exit without interfering commands (see job control ). If any job is stopped, shell always Suspends. If checkwinsize is set, Bash checks the window size after each command. if necessary, it updates the values of LINES and COLUMNS. If cmdhist is set, Bash stores the content of all lines of a multi-line command in the same historical object. In this way, you can easily re-edit the multi-line command. Compat31 if set, Bash changes its behavior to conform to version 3.1. the conditional command operator '= ~ 'Method of parameters enclosed by quotation marks. Compat32, if set, Bash changes its behavior to conform to version 3.2. when the '[[' condition command '<' and '>' operators are used, the region-specific string comparison method is used. Bash versions earlier than Bash-4.0 use ASCII and strcmp (3); bash-4.1 and later use the sequence set in the current region and strcoll (3 ). Compat40 if set, Bash changes its behavior to conform to version 4.0. when you use the '<' and '>' operators of the '[' condition command, comparison of region-specific strings (see the previous project) and the impact on the interruption of a command list. Compat41 if set, Bash treats single quotation marks in the double quotation mark parameter extension as special characters in POSIX mode. Single quotes must be matched (even). the characters between single quotes are considered to be enclosed by single quotes. This is the behavior of POSIX mode 4.1. Other default Bash behaviors are still the same as those of previous versions. If dirspell is set, Bash automatically modifies the spelling when the input directory name does not exist. If dotglob is set, Bash contains a file name starting with '.' in the file name extension result. If you set execfail, the non-interactive shell will not exit when the file specified by the exec parameter of the built-in command cannot be executed. If exec fails, the interactive shell does not exit. If expand_aliases is set, all aliases are described in the "Alias" section below. In interactive shell, this option is enabled by default. If extdebug is set, enable the available behavior of the debugger: 1. declare built-in command-F option, displays the source file and row number of each corresponding function name provided as a parameter. 2. if a non-zero value is returned for a command running in the DEBUG trap, the next command is skipped and not executed. 3. if a value of 2 is returned for the command running in the DEBUG trap, and the shell is executed in the sub-process (using the. or source Command), a return call is simulated. 4. BASH_ARGC and BASH_ARGV are updated according to their descriptions. (See Bash variables) 5. enable function tracing: command replacement, shell functions, and sub-shells called using (command) inherit the DEBUG and RETURN traps. 6. enable error tracking: commands replacement, shell functions, and sub-shells called by command inherit the ERR trap. If extglob is set, enable the above extended mode matching function. (See pattern matching) if extquote is set, $ 'string' and $ "string" in the $ {parameter} extension in double quotation marks are extended by quotation marks. This option is enabled by default. If failglob is set, an extension error occurs when the pattern matching fails during file name extension. If force_fignore is set, when the word is supplemented in full time, shell variables with the suffix specified by FIGNORE will ignore the word, even if the word to be ignored is the only complement alternative. For more information about FIGNORE, see the bash variable section. This option is enabled by default. If globstar is set, the format "**" used in file name extension will match all files and 0 or multiple directories and subdirectories. If the mode ends with '/', only directories and subdirectories are matched. If gnu_errfmt is set, shell error messages are output in the standard GNU error message format. If histappend is set, when the shell exits, the Command History list will be appended to the file set by the variable HISTFILE, instead of overwriting the file. If histreedit is set, Readline is used, and the user will have the opportunity to re-edit the failed command history replacement. If histverify is set, Readline is used. the result of historical command replacement is not passed to the shell interpreter immediately. Instead, it is loaded into the Readline buffer to allow future modifications. If hostcomplete is set, Readline will be used. when the word contains '@', Bash will try to execute the host name. (See "command completion "). This option is enabled by default. If huponexit is set, Bash sends SIGHUP to all jobs when the interactive shell exits. (See "signal") in the interactive shell, a word starting with '#' will cause the word and all characters after the word in the row to be ignored. This option is enabled by default. If lastpipe is set and the job control is not activated, the shell that runs the last command of the pipeline is not executed in the background of the current shell environment. If lithist is set and the cmdhist option is set, the multiline command is saved to history and contains a line break instead of a semicolon. Login_shell if the shell is started from the logon shell, the shell sets this option. (See "Bash") this value cannot be changed. If mailwarn is set and Bash is used to detect The file of The email, The message "The mail in mail file has been read" is displayed when it is accessed again after The last detection ". If no_empty_completion is set and Readline is used, Bash no longer tries to search for available commands from PATH on the empty line. If nocaseglob is set, Bash matches the file name in uppercase/lowercase case insensitive mode during file name extension. If nocasematch is set, execute case or [conditional command, Bash matches the pattern in case-insensitive mode. If nullglob is set, Bash allows the file name pattern that does not match any file to be extended into an empty string, not the pattern itself. If progcomp is set, the programmable automatic completion tool is activated. (See "programmable automatic completion "). This option is activated by default. If promptvars is set, after the prompt string is extended, parameter extension, command replacement, arithmetic extension, and quotation mark removal are also executed. (See the print prompt ). This option is activated by default. Restricted_shell this option is set if the shell is started in Restricted Mode. (See "restrict shell "). This value cannot be changed. When the startup file is executed, do not reset this option to allow the startup file to detect whether the shell is restricted. If shift_verbose is set, when the shift counter exceeds the number of location parameters, the shift built-in command prints an error message. If sourcepath is set, the source built-in command uses the PATH value to find the Directory of the file name as the parameter. This option is activated by default. If xpg_echo is set, the built-in echo command expands the backslash escape sequence by default. If all optnames are activated, the command listing options returns 0; otherwise, it is a non-zero value. When setting or canceling options, the returned status is 0, unless optname is not a valid shell option.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.