1th. Bashshell command------------(default shell environment variable and PATH variable setting)

Source: Internet
Author: User
1.6.2 Default shell environment variables and PATH variable settings 1. Default shell environment variables

Bashshell default will use some specific environment variables to define the system environment. You can always rely on the variables set in these Linux systems. Because the bash shell derives from the original Unix Bourn shell, it also includes the environment variables that were originally defined in the shell. Listing bash shells provides environment variables that are compatible with the original UNIX Bourn shell:

The PATH environment variable defines the directory in which it searches for commands. In my Linux, the path variable is shown as follows:

Each directory in path is separated by a colon. There is no mark at the end of the path variable to indicate that the catalog list ends. you can easily add additional directories to the path by simply adding a colon and a new directory later . Path also shows the order in which the shell looks for commands. In addition to the default Bourne environment variables, Bashshell provides some of its own variables:

When you use the SET command, not all default environment variables are displayed. The reason for this is that although there are many default environment variables, not all variables need to contain values. 2. Set the PATH environment variable

The biggest problem that occurs on a Linux system is caused by the PATH environment variable, which defines where the shell looks for command-line input commands. The problem is that applications often place their executable programs in a directory other than the PATH environment variable. The trick is to make sure that the PATH environment variable contains all the directories where the application resides. You can add a new search directory to an existing PATH environment variable without rebuilding it. The directories listed in path are separated by colons. Just apply the original path value and add any new directories to the string:

By adding a directory to the PATH environment variable, you can execute the program anywhere in the virtual directory structure. One of the tricks programmers often use is to include a point symbol in the PATH environment variable. A single point symbol represents the current directory . 3. Positioning System Environment Variables

Linux systems use environment variables to identify themselves in programs and scripts. When you launch the bash shell by logging in to the Linux system, bash checks some files to execute the command by default. These files are called startup files. The startup file that bash handles 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. Interactive shell as a non-login shell;

3. Run the script as a non-interactive shell.

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.