Linux Learning Path 4-bash environment configuration

Source: Internet
Author: User

Bash Environment Configuration

Profiles : divided by effective scope, two categories:

Global configuration file:/ETC/PROFILE,/ETC/PROFILE.D/*.SH,ETC/BASHRC

Personal configuration file: ~/.BASH_PROFILE,~/.BASHRC

Classification by function: two types:

profile class: Interactive login ( i.e. login or su-username directly via the terminal)

/etc/profile,/etc/profile.d/*.sh,~/.bash_profile

function: 1. Define environment variables, such as PATH,PS1 2. Run a command or script

BASHRC class: Non-interactive login (Command window open under graphical interface, execute script, su username)

/etc/bashrc,~/.bashrc

function: 1. Define command Aliases 2. Define Local variables

configuration file Action order:

Interactive login:/etc/profile,/etc/profile.d/*.sh->~/.bash_profile, ~/.BASHRC,/etc/bashrc< /c7>

non-interactive login: ~/.BASHRC---/ETC/BASHRC->/etc/profile.d/*.sh

How does the configuration file change?

  1. Re-Login

  2. Lets the shell process reread the specified configuration file, source or. This way, but there will be some side effects

    Bash the variables in :

    Type:

    Environment variables: scope current shell process and its child processes

    local variable: scope current shell process

    Local variables: scoped only to a snippet of code in the current shell process (usually a function context)

    Position variable: $ $, $

    Special variables: $?

    How variables are defined:

    Bash built-in variables: can be called directly, built in a number of environment variables, such as Path

    Custom variable: variable assignment: variable name = value

    Bash Weak type:

    When a variable stores data, it is written by default, and any variable can be directly referenced without being declared;

    to define a local variable:

    Name=value

    View: Set

    Define environment variables:

    Export Name=value

    Declare-x Name=value

    View variables: env, printenv, export

    undo variable: Unsetname

    reference variable: ${name}, $name

    Bash the reference symbol in:

    "': strong references, variable substitution does not occur

         "" : Weak references

         ``: Command Reference


This article is from the "naïve Little Comrade" blog, please be sure to keep this source http://dengxi.blog.51cto.com/4804263/1691234

Linux Learning Path 4-bash environment configuration

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.