Shell starts file and environment variable

xiaoxiao2021-03-06  19

Shell starts file and environment variable

Each shell starts, executes commands, and programs, how to handle commands and programs input and output, and any programming is affected by certain environment variable settings. Each system has an initial system startup file, usually Yes / etc / profile. This file contains an initial setting of important environment variables that works on shell and other utilities. In addition, there are some hidden files and point files to execute when you start the shell, these The file is also called the start file of the shell, which is usually a user's home directory ~ / .profile, or a specific shell's Profile or login file. For example, Bash's Profile Han Ogin file is usually ~ / .bash_profile and ~ / .bash_login.

When you log in and log in to the shell is BASH, Bash first executes commands in the / etc / profile file (if this file exists), then it looks for ~ / .bash_profile, ~ / .bash_logi or ~ / .profile file, and execute The command in the first readable file is found. When logging in to Bash exits, it will execute the command in the ~ / .bash_logout file.

When starting an interactive BASH, it will execute the command in / .bashrc file (if the file exists and read). When you start a shell script, Bash will look for the Bash_Env environment. I have determined the name of the execution file.

If you are using the TC shell, it will execute the command in the /etc/csh.cshrc or the etc / .chsrc file (if the file exists and read). Log in to the shell and will execute the /etc/csh.login file. Life?? If this file exists and readable). Each Hell (Sign in Shell or Non-login shell) will then execute ~ / .tcshrc file (if ~ / .tcshrc does not exist is ~ / .cshrc file) Command, and read the contents of the ~ / .history file. Log in to the shell will execute the command in / .login and ~ / .cshdirs file. When a TC shell exits, it will perform /tc/csh.logout and ~ / The command in the .login file (if the file exists and readable).

转载请注明原文地址:https://www.9cbs.com/read-44528.html

New Post(0)