Enable and disable shell features

Source: Internet
Author: User
Turn on and off the shell feature-general Linux technology-Linux programming and kernel information. The following is a detailed description. Note: shopt is the full name of shell option.

You can enable or disable the Bourne Again Shell function to control its behavior. Different functions are enabled and disabled in different ways. The built-in command set controls a set of functions, while the built-in command shopt controls another set of commands. You can also call bash to control many functions in the command line.

1. set ± o: Enabling and disabling shell features
By using the-o or + o option, the built-in command set (tcsh has a built-in command set, but it works differently) can enable, disable, and list some bash features. For example, the following command will enable the noclobber feature:

$ Set-o noclobber

Use the following command to disable this feature (default ):

$ Set + o noclobber

2. shopt: Enabling and disabling shell features
The built-in command shopt (shell option) enables, disables, and lists some bash features that control shell behavior. For example, the following command will enable bash to include the file names starting with periods (.) when extending the fuzzy file reference.-s indicates the settings:

$ Shopt-s dotglob

Use the following command to disable (default) This feature.-utable shows unsetting:

$ Shopt-u dotglob

If you only use the feature name as the unique shopt parameter, shell shows how this feature is set:

$ Shopt dotglob

Dotglob off

When the command shopt does not contain any options or parameters, it lists the features and statuses controlled by shopt. When the shopt-s command does not contain parameters, the features controlled by shopt and set to enabled are listed. Command shopt? U will list the bash features canceled or disabled.
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.