Command Manual: Linux set command

Source: Internet
Author: User
Tags line editor

There are many commands in the operating system. Maybe many of you know about Microsoft. Although Linux has developed since Microsoft, Linux has surpassed Microsoft in recent years. This article describes the Linux set command in detail, which plays a certain role in learning the Linux set command.

You can use the set command to set various shell options or list shell variables. set common features for a single option. after some options, the-o parameter opens special features. after some options, using the + o parameter will disable some features. The set command without any parameters will display all shell variables. unless an invalid option is encountered, set always returns true.

When the shell is called, all options can be listed. the current option set is listed in $. after the option parameter is processed, other parameters are assigned to the position parameter ($1, $2 ,..., $ n)

Set [-- abefhkmnptuvxldCHP] [-o option name] [arguments...]

Option description

-A automatically signs the variable that has been modified or the variable that is used to export the sorted command.
-B is not a status table that immediately triggers termination of background tasks, rather than before the original prompt.
-E. If the command returns a non-zero value, exit immediately.
-F prohibit paths with extensions
-H: when defining a function, locate and store function commands. When a function is executed, query function commands.
All-k keyword parameters, not just those before the command name, are placed in the Environment command
-M monitor mode: Enable task control. This option supports system shell interaction by default. background processes run in a separate process group and contain exited status lines each time a task is completed.
-N: reads the command but does not execute the command. syntax errors of shell scripts are usually monitored. The interactive shell is ignored.
-O option-name can be one of the following:

Option description

Allexport with-a option
Braceexpand shell executes curly extension, which works by default
Emacs uses the emacs-style command line editing interface. Unless the shell starts with the-noline-editing option, this option is enabled by default during shell interaction.
Errexit is the same as-e Option
Histexpand same as-H Option
The result of ignoreeof is as if the shell command IGNOREEOF = 10 was executed.
Interactive allows a word to be preceded by a # sign so that all the characters in the command line are ignored in the interactive shell-commands
Monitor with the-m Option
Noclobber is the same as-C option
Noexec with-n Option
Noglob with-f Option
Nohash with-d option
Notify with-B Option
Nounset same-u Option
Physical same-p Option
Posix changes the BASH attribute to match the standard. The default operation is different from the POSIX1003.2 standard.
Verbose with-v Option

Vi uses the vi-style command line editor

XTRACE is the same as-x option. If no option name is provided, the current option value is displayed.
-P open the privileged mode (In this mode, $ ENV file is processed and cannot be inherited from the Environment
Shell function. It is automatically started if it is a valid user id rather than a real user group. Disabling this option will enable valid users and group IDs to set the user and group IDs)
-T exit after reading and executing the command
-U when the execution parameter is included, the unset variable is used as the error handling (if the extension attempt appears in the unset variable, the shell displays the error message. if it is not interactive, exit with a non-ling value)
-V: The shell input line is displayed when the input line is read.
-X: after each simple command is extended, the PS4 extension value is displayed, followed by the command to be executed.
-L save and restore the name bound to the command
-D prohibit the execution of the "Search for hash" command (normally, the command is saved in the hash list and will not be searched again once it is found)
-The effect of C is that the noclobber = shell command is executed.
-H usage! Historical style substitution (this option is valid by default when shell interaction is performed)
-P if this parameter is set, when the directory command cd is executed, the actual directory is used instead of the symbolic link.

If there is no parameter after the option, do not set the location parameter. otherwise, you must set the location parameter to the signal of the argument-end option even if some parameters start with option, other parameters are assigned to the location parameter (-x and-v Options are disabled. if there is no argument, the location parameter will be retained)

We hope that the introduction in this article will allow you to learn about the Linux set command.

  1. Easily connect to the campus network using Linux
  2. Fully Understand Linux Process Technology
  3. Introduction to the password command in Linux
  4. Learn about Linux regulatory commands
  5. How to view the ps-aux command of all processes in Linux

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.