Linux Shell Set__linux

Source: Internet
Author: User
SET Command

The set command acts primarily to display shell variables that already exist in the system, and to set new variable values for shell variables. When you use set to change shell attributes, the function of the symbol "+" and "-" is to turn the specified mode on and off, respectively. The set command is not able to define a new shell variable. If you want to define a new variable, you can use the DECLARE command to define the format of the variable name = value. Grammar

Set (options) (parameters) options

-A: Marks the modified variable for output to the environment variable.
-B: Causes the aborted daemon to immediately return the execution status.
-C: The resulting file cannot overwrite files that already exist.
-d:shell Presets Use instructions that are used in hash table memory to speed up the execution of instructions. Use the-D argument to cancel. - 
e: If the instruction returns a value of not equal to 0, exit the shell immediately. (execution error will not continue)-
F: Use wildcard characters. - 
H: Automatically record the location of the function. 
-H Shell: can use "!" Add < instruction number > to execute the instructions recorded in the history. - 
K: The parameters given by the directive are treated as environment variables for this instruction. - 
L: Records the name of the variable for the For loop. - 
m: Use monitoring mode. - 
N: Read only instructions, not actual execution. - 
P: Starts the precedence mode. 
-P: When the-P argument is executed, the symbolic connection is replaced with the actual file or directory when executing the instruction. - 
t: Exit the shell after executing the subsequent instruction. - 
u: An error message is displayed when execution is used to a variable that is not defined. - 
V: Displays the input values that the shell reads. - 
x: After the instruction is executed, the instruction and the parameters below are displayed first. (scripts can be executed to see the execution process)
Parameters
Cancels a parameter that was started by a set.
instance

Use the DECLARE command to define a new environment variable "MY_ENV" and set its value to "test" and enter the following command:

Declare my_env= ' test ' #定义新环境变量

Then using the SET command to output the newly defined variable as an environment variable, enter the following command:

Set-a my_env #设置为环境变量

When the command is executed, the corresponding environment variable is added. Users can display and search the environment variable "Mylove" using the env command and the grep command, and enter the following command:

env | grep mylove #显示环境变量值

At this point, the command executes to output the value of the environment variable to which the query is queried.

From: Http://man.linuxde.net/set

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.