Parameters and usage of SET command under Linux

Source: Internet
Author: User

Linux SET command

Feature Description: Set up the shell.

Syntax: Set [+-ABCDEFHHKLMNPPTUVX]

Additional instructions: Use the SET command to set various shell options or to list shell variables. A single option sets commonly used attributes. After some options, the-o parameter opens special properties. Using the +o parameter after some options will turn off certain attributes, without any parameters The all variables of the shell are displayed. Set always returns ture unless an illegal option is encountered.

Parameters

Allexport-a tag all new and modified variables for output from the start of the setup

Braceexpand-b allow symbol extensions, default options

Emacs uses the built-in Emacs Editor for Command editing, with the default options

ERREXIT-E If a command returns a non-0 exit status value (failed), exit.

Histexpand-h is allowed to use when making a temporary replacement!!! Default options

History allows command-line histories, default options

Ignoreeof prohibit coontrol-d from exiting the shell, you must enter exit.

Interactive-comments in interactive mode, #用来表示注解

Keyword-k the keyword parameter in the environment for the command

Monitor-m Allow Job control

Noclobber-c protection files are not overwritten when using re-movement

Noexec-n reads commands in script state but does not execute, primarily to check the syntax structure.

noglob-d prohibit path name extension, that is, to turn off wildcard characters

Notify-b notify customer after background job

NOUNSET-U Displays the wrong information when you expand a variable that does not have a setting

Onecmd-t exits after reading and executing a new command

Physical-p if set, the path to the symbolic connection is not used when using the PWD and CD commands instead of the physical path

POSIX changes shell behavior to meet POSIX requirements

Privileged once set, the shell no longer reads. profile files and env file shell functions do not inherit any environment

VERBOSE-V open verbose mode for debugging

VI use the built-in VI editor when editing at the command line

Xtrace-x turn on debug-echo mode

Set the system environment variable in the following two articles in this site are described in detail:
Setting environment variables for permanent entry export ps1:http://www.linuxso.com/a/linuxxitongguanli/1812.html

Extended reading: Set,env and export These three commands can be used to display the shell variables, the difference?

Set is used to display local variables
env to display environment variables
Export to display and set environment variables

Set displays variables for the current shell, including variables for the current user
ENV displays the current user's variables
Export Displays the shell variables currently exported as user variables

Each shell has its own unique variable (set), which is different from the user variable, and the current user variable is not related to what shell you are using, no matter what shell you use, such as Home,shell, But the shell's own variable shell is different, such as BASH_ARGC, Bash, and so on, these variables only set will be displayed, is bash-specific, export does not add parameters, show which variables are exported to the user variables, Because a shell's own variable can be converted to a user variable by exporting "export"

[Email protected] ~]# AAA=BBB

[Email protected] ~]# echo $aaa
Bbb

[[email protected] ~]# Set|grep AAA
aaa=bbb

[[email protected] ~]# Env|grep AAA

[[email protected] ~]# Export AAA

[[email protected] ~]# Env|grep AAA
aaa=bbb

Extended Data Two: Environment variable commands in set, env, Export--linux

Linux is a multi-user operating system. After each user logs on to the system, there is a dedicated runtime environment. Typically, the default environment for each user is the same, and the default environment is actually the definition of a set of environment variables. Users can customize their own operating environment by modifying the appropriate system environment variables.

What is an environment variable

An environment variable is an object with a specific name that contains the information that one or more applications will use. Many users, especially those who have just come into contact with Linux, find these variables somewhat bizarre or difficult to control. In fact, this is a misunderstanding: by using environment variables, you can easily modify a configuration information that involves one or more applications.

Common environment variables

We are not unfamiliar with environment variables such as path and home.

Path can specify the search path of the command, what variable is the path of the dynamic link library specified? Or is it in path?
For example, a program needs to/usr/local/lib the following library file, how should you specify its path?
Often see some variables such as Ld_library_path,libpath,classpath, what are their differences and relationships?

In addition, there are some common environment variables below.

Histsize refers to the number of records in which history commands are saved.

LogName refers to the login name of the current user.

Hostname refers to the name of the host, and many applications are usually obtained from this environment variable if they want to use the hostname.

The shell refers to what kind of shell the current user is using.

Lang/languge is a language-related environment variable that users of multiple languages can modify.

Mail refers to the current user's message store directory.

PS1 is the basic prompt, for the root user is #, for the average user is $. PS2 is a secondary prompt and the default is ">". You can modify the current command by modifying this environment variable, such as the following command to modify the prompt to the string "Hello,my newprompt".

Parameters and usage of SET command under 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.