shopt

control optional shell behavior 

KornShell Built-in


SYNOPSIS

shopt [-opq] [-s|-u] [optname]


DESCRIPTION

The shopt built-in command controls optional shell behavior. When no options are specified or with the -p option, shopt displays a list of all settable options with an indication of whether or not each is set.

Besides setting the shopt-specific options listed below, you can also use shopt to set any -o option described in the set reference page.

Note:

There may be additional shell options that can be set with the shopt command that are not listed in this or the set reference page. Such options, if any, do appear in the list of all settable options displayed by shopt.

Options

-o 

restricts the values of optname to exclude the shopt shell options below. That is, you can specify those options which appear on the set reference page but not on this page.

-p 

displays the option list in a format that can be used as input.

-q 

suppresses the normal output generated by shopt. The exit status indicates whether optname is set or unset. If you specify multiple optname arguments, the exit status is zero if all the specified optnames are set; otherwise, the exit status is non-zero.

-s 

sets each specified optname.

If you specify this option without any optname arguments, shopt displays all shell options that are currently set.

-u 

unsets each specified optname.

If you specify this option without any optname arguments, shopt displays all shell options that are currently set.

shopt Shell Options

dotglob 

specifies that wild card patterns will match file names that start with the . character during file name generation.

By default, this option is off and wild card patterns will not match file names that start with the . character.

login_shell 

is set by the shell when it is invoked as a login shell. This value can not be changed.

no_empty_cmd_completion 

prevents command completion from occurring when no characters have yet been typed.

This option is off by default.

restricted_shell 

is set when you start the shell in restricted mode (see the description of the -r option in the sh reference page). The value may not be changed. The shell does not reset this option when the startup file are executed, allowing the startup files to discover whether or not a shell is restricted.


DIAGNOSTICS

When listing shell options, the exit status is zero if all optnames are set; otherwise, the exit status is non-zero.

When setting or unsetting options, the exit status is always zero unless an optname is not a valid shell option.


PORTABILITY

Bourne-Again Shell. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
cd, echo, exec, set, sh, shift


PTC MKS Toolkit 10.4 Documentation Build 39.