Linux Bash environment variables

Source: Internet
Author: User
Linux Bash environment variable command execution order 1 execute command in relative/absolute PATH 2 find this command by alias execute 3 execute command built in bash 4 search first through the $ PATH variable order command to execute loginshell and non-loginshellloginshell complete... linux Bash environment variable command execution order 1 execute command in relative/absolute PATH 2 find this command by alias execute 3 execute command built in bash 4 search first through the $ PATH variable order command to execute the complete login process of login shell and non-login shelllogin shell. Enter the username and password in the tty1-tty6/etc/profile system configuration file ~ /. Bash_profile or ~ /. Bash_login or ~ /. Profile user's personal configuration file. Non-login shell does not need to repeat the login process. One is to enter the X window and then start the terminal. The other is to start the bash process again in the bash environment ~ /. Bashrc user's built-in command source (or use the decimal point ".") related to the environment variables in the personal configuration file to read and execute the environment configuration file. modify the configuration file without logging out and then log on. Echo output environment variable export pass environment variable to its sub-process set display environment variable or set environment variable unset cancel variable environment variable related command env view existing environment variable locale view current language information stty display or set the text terminal settings, it is mainly the representative of the buttons. environment variable setting rule 1 variables and variable content are connected by equal signs. There cannot be spaces on both sides of the equal sign. The variable must start with a letter. Linux code $ mypath =/home/mydata // sets the difference between double quotation marks and single quotation marks in the content of environment variable 2. Linux code $ mypath = "lang is $ LANG" // retain the meaning of special characters $ mypath = 'Lang is $ lang '// All characters are considered as common characters 3 can be transferred character "\", converts a special character to a general character. 4. to reference the result of a command, you can use the 'command' or $ (command) Linux code $ echo 'uname-R' $ echo $ (uname-r) 5. if you give a variable an increment, you can run the Linux code $ mypath = "$ mypath":/home/bin 6. if you pass the variable to its sub-process, you can delete and replace the $ export mypath variable in Linux code $ {variable # Keyword} and check keywords from the beginning, delete the compliant shortest data $ {variable # Keyword} from the beginning, and delete the conforming longest Data $ {variable % keyword} from the end, delete the matching shortest data $ {variable % keyword} from the end and check the keywords. delete the matching longest Data $ {variable/old string/new string}. if the matching shortest data matches the old string, then the first old string is replaced with $ {variable // old string/new string}. if the string matches the old string, all old strings are replaced with the variable content and var and str are replaced with the variable content, expr is normal String variable setting mode str is not set str to a null string str has been set to a non-empty var =$ {str-expr} var = expr var = $ strvar =$ {str: -expr} var = expr var = $ strvar =$ {str + expr} var = expr var = exprvar =$ {str: + expr} var = exprvar =$ {str = expr} str = exprvar = exprstr unchanged var = str unchanged var = $ strvar =$ {str: = expr} str = exprvar = exprstr unchanged var = $ strvar =$ {str? Expr} expr output to stderr var = $ strvar =$ {str :? Expr} expr output to stderr var = $ str

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.