Linux Learning--Positioning System environment variables

Source: Internet
Author: User

Linux systems use environment variables to identify themselves in programs and scripts. This provides an easy way for your program to obtain system information. The question is how to set these variables.

When your Linux system launches a bash shell, bash looks for commands in several files by default. These files are called startup files. The startup file that bash checks depends on how you start the bash shell. There are three ways to start the bash shell:

1, log in as the default login shell

2. As a non-login interactive shell

3. As a non-interactive shell when running scripts

  

First, login shell

When you log in to a Linux system, the Bash shell is launched as a login shell. The login shell reads commands from 4 different boot files, and the following is the order in which the bash shell handles these files:

1./etc/profile

2. $HOME/.bash_profile

3. $HOME/.bash_login

4. $HOME/.profile
Second, interactive shell

If you are not booting when you are logged into the system (such as typing bash at the command prompt), you are launching the bash shell. It does not access the/etc/profile file after it starts, but goes to the home directory to check

The. BASHRC is present.

. BASHRC has two functions one is to view the BASHRC file in the/etc directory, and the second is to provide a place for users to customize their own command aliases for private script functions.

Third, non-interactive shell

The shell that the system uses to execute shell scripts is the shell

Linux Learning--Positioning System 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.