Shell after class summary

Source: Internet
Author: User
Tags python script

Shell after class summary

High waves

Archive: Learning Notes

December 4, 2017 13:31:08

Shortcut keys:

Ctrl + 1 title 1

Ctrl + 2 title 2

Ctrl + 3 title 3

Ctrl + 4 Example

Ctrl + 5 Program Code

Ctrl + 6 Body

Format Description:

Blue font: Comments

Yellow background: Important

Green background: note

    1. Directory

1.1 Mesh record I

Chapter I. 1

1.1.1 Built-in commands and General command built-in commands are highly efficient. 1

1.1.2 Yum is python written by default system Python is 2.7. If the direct download of the 3.0 overlay will cause Yum to be unavailable. 1

1.1.3 script in different languages of the shell. 1

1.1.4 four ways to execute a shell script. 2

1.1.5 SH Execute when you create a new shell window (create a new process) execute the contents of the file 2

1.1.6 environment variables. 2

1.1.7 defines 5 files for an environment variable. 3

The order of 1.1.8 environment variables is. 4

1.1.9 system where so many variables are stored. Scattered in 4 system files and/ETC/PROFILE.D directories below 5

Chapter I.
    1. Built-in commands and General command built-in commands are highly efficient.

Built-in commands, the system starts to load. Read from memory, fast, high efficiency

General commands require reading from the hard disk and are inefficient.

    1. Yum is python written by default system Python is 2.7. If you download the 3.0 overlay directly, Yum will not work.

Need to replace the default path installation

[email protected] ~]# which Yum

/usr/bin/yum

[Email protected] ~]# File/usr/bin/yum

/usr/bin/yum: Python script, ASCII text executable

    1. Scripting scripts in different languages of the shell.

    1. Four ways to execute a shell script.

The first type:

SH oldboyedu.sh

Bash oldboyedu.sh

The second type:

chmod +x./oldboyedu.sh

./oldboyedu.sh

The third method of execution:

Cat Oldboyedu.sh|bash

The fourth type:

SOURCE Source is a command that executes a file in the current shell

. Click the script name.

    1. SH Executes a new shell window (creates a new process) executes the contents of the file

    1. Environment variables.

Environment variables are generally called global variables.

General variables are also called local variables.

Environment variable: The current shell and all child shell windows take effect globally.

If it takes effect in the newly opened shell, it needs to be written to the configuration file.

Define environment with export

[Email protected] scripts]# Aa=oldboy

[Email protected] scripts]# echo $AA

Oldboy

[Email protected] scripts]# vim tt.sh

Echo $AA

Echo $BB

[Email protected] scripts]# sh tt.sh

[Email protected] scripts]# source tt.sh

Oldboy

Source load the script into the current script to run .

    1. 5 files that define an environment variable.

/etc/profile

/etc/bashrc

~/.bashrc

~/.bash_profile

/etc/profile.d/

    1. The order of the environment variables is.

/etc/profile===>~/.bash_profile====>~/.bashrc=====>/etc/bashrc

    1. The system is where so many variables are stored. Scattered under 4 system files and/ETC/PROFILE.D directories

System variables are placed in many places

There are four global variables in the location file.

Shell after class summary

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.