BASH configuration file read steps

xiaoxiao2021-04-05  321

Bash's most common activation mode is interactive and non-interactive: 1. Interactive activation means that its standard input and output are connected to the terminal. It is divided into three types: Login, non-login, POSIX, and restricted shell. Determine if a shell is an interactive can be detected by detecting $ PS1 environment variables. (1) When Bash is activated as a login shell, it will read and perform the following files: /etc/profile ,~/.bash_profile ,~/ .bash_login, ~ / .profile Using --noprofile Option Activation BASH You can do it when you read any initialization files, execute it ~ / .bash_logout file (2) when Bash is activated as a non-login shell, it will be read and executed ~ /.bashrc Use -norc Option Activation Bash can prohibit any initialization files, using -rcfile file can specify the initialization file that is executed. (3) When Bash is activated as POSIX mode, it will check if the $ ENV variable is defined. If defined, BASH reads and executes files obtained with $ ENV variable extension, otherwise no initialization file is not performed. (4) When BASH is activated as a restricted mode, other acts are the same in other modes, in addition to some operations, the restricted operations are: changing the directory, modify $ shell and $ PATH variables, run EXEC, with absolute path Running procedures and use redirection. Bash 1.x does not contain restricted mode. 2. Non-interactive activation is mainly used to run the shell script. After startup, Bash checks $ bash_env variable, if defined, this executes the variable specified file The included command. BASH activation options -c string This option indicates that a command contains a command. Such as Bash -C ls ~ -i makes BASH to run the BASH in a limited way - Login makes Bash Running in logging in to Shell - Posix makes BASH to follow the POSIX standard --verbose to make BASH to display all its read input line - HELP Print Bash Using Information - Version Print Version Information --NOPROFILE - Norc --Rcfile File

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

New Post(0)