Shell scripts fall into three categories: logon scripts, interactive scripts, non-interactive scripts

Source: Internet
Author: User

Shell scripts fall into three categories: logon scripts, interactive scripts, non-interactive scripts

One

The logon script is similar to the logon script in the computer settings under Windows and the collection of logon scripts under Account settings (I understand that well).

The keyword for its profile is Prefile, which has several key configuration files:

/etc/prefile This is a computer script; [$home/.prefile; $home/.bash_prefile; $home/.bash_login] These three are account scripts, different names depending on the distribution (Pit Daddy Linux);

Description:/etc/prefile is so cool, it should be related to the internal export, export-defined environment variables, will be defined as global variables.

Reading order

Before login/etc/profile >>/etc/profile.d/* #/etc/profile use for loop call/etc/prefile.d/ *

$home/.profile >> $home/.BASHRC (if available) when you log in to your account

I'm not so sure about this order, but it's not a clear book, but it shouldn't be wrong.

Two

Interactive scripting, which is used primarily for login accounts, is called when the new shell process is created, and it no longer calls/etc/prefile. According to its characteristics: When using Alisa to create an alias, it can be written to $HOME/.BASHRC, because every time you start the terminal simulation package or shell, always call it.

The keyword for its profile is BASHRC, which has several key configuration files:

$home/.BASHRC;/ETC/BASHRC

$home/.BASHRC This script calls/ETC/BASHRC, and/ETC/BASHRC calls/etc/profile.d/

Description:/ETC/BASHRC belongs to/etc, needless to say, must be read by any account

Reading order $HOME/.BASHRC >>/ETC/BASHRC >>/etc/profile.d/*

Icon:

Three

A non-interactive script that is primarily used when the system executes a shell script.

Linux has a global environment variable bash_env, which functions as a non-interactive script to achieve its value, but this variable is not set by default.

You can use bash_env=*** to do a little work for it. Of course, to long-term use, but also to add to./bashrc.

Shell scripts fall into three categories: logon scripts, interactive scripts, non-interactive scripts

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.