Display and setting of Variables

Source: Internet
Author: User

Display variables and set the display format of variables: # echo $... # echo $ variable # echo $ PATH or echo $ {PATH} # myname = tian # echo $ myname can be enclosed in double quotation marks or single quotation marks if there is any space in the variable, however, special characters in double quotation marks, such as $, can maintain the original characteristics. The single quotation marks are generally characters. To provide information through other commands, you can use the unquoted command or $ (command), such as version = $ (uname-r). If the variable needs to be executed in other sub-processes, use the export declaration to program environment variables. Cancel the variable and use "unset variable name" to accumulate PATH = $ PATH:/home/dmtsai/bin =$ {PATH} using the escape character name = vbnird \'s \ space name }: /home/dmtsai/bin display environment variables # env view all variables # set $ display the shell PID (shell thread code) # echo $? Display the return code of the previous command 0: Success 1: Failure # echo $? Export: converting a custom variable to an environment variable only inherits the environment variable of the parent process, custom variables are not inherited # All environment variables of export are listed # The export variable name declares the custom variables as Environment Variables

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.