Steps for reading bash configuration files

Source: Internet
Author: User
Tags posix
The most common activation modes of bash are interactive and non-interactive:
1. Interactive Activation
The standard input and output are connected to the terminal. There are three types: Login, non-login, POSIX
And restricted shell.
Check whether a shell is interactive. You can check the $ PS1 environment variable.
(1) When Bash is activated as the login shell, it reads and runs the following files in sequence:
/Etc/profile ,~ /. Bash_profile ,~ /. Bash_login ,~ /. Profile
Use the -- noprofile option to activate bash and disable it from reading any initialization file.
Execute when exiting ~ /. Bash_logout file
(2) When Bash is activated as a non-login shell, it will read and execute ~ /. Bashrc
Use the -- NORC option to activate Bash to disable execution of any Initialization Files. Use
-- Rcfile file specifies the initialization file to be executed.
(3) When Bash is activated as the POSIX mode, it first checks whether the $ ENV variable is defined.
If defined, bash reads and executes the file with $ ENV variable extension. Otherwise, it does not
Execute any initialization file.
(4) When Bash is activated as the restricted mode, it does not prohibit some operations
Similar to other modes. Restricted operations include: Changing directories, modifying $ shell and $ PATH variables,
Run exec, run the program in an absolute path, and use redirection. Bash 1. X does not contain
Restricted mode.
2. Non-interactive Activation

Mainly used to run shell scripts. After the startup, bash checks the $ bash_env variable. If it is defined,
Run this variable to specify the commands contained in the file.
Bash activation options

-C string this option indicates that the string contains a command, such as Bash-c ls ~
-I used Bash to run in interactive mode
-R enables Bash to run in restricted mode
-- Login enables Bash to run in Shell login Mode
-- POSIX enables Bash to comply with POSIX standards
-- Verbose enables Bash to display all input rows it reads
-- Help print bash usage information
-- Version: prints version information.
-- Noprofile
-- NORC
-- Rcfile File

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.