1. Shell Concept
The shell is a program written in C, which is a bridge for users to use Linux
The shell is both a command voice and a programming voice
A shell is an application that provides an interface through which users access the operating system kernel's services
2. Shell Script
Shell script is the full name of shell scripts, a script written for the shell
Ken Thompson's SH is the first UNIX Shell
3. Shell Environment
Shell programming as long as there is a text editor that can write code and a script interpreter that interprets execution
The common shell types in Linux are:
Bourne Shell (/usr/bin/sh or/bin/sh)
Bourne Again Shell (/bin/bash)
Easy to use and free, bash is widely used in daily work
Bash is the default shell for most Linux systems
C Shell (/USR/BIN/CSH)
K Shell (/usr/bin/ksh)
Shell for Root (/sbin/sh)
In general, people do not differentiate between the Bourne shell and the Bourne Again shell, so, like #!/bin/sh, it can also be changed to #!/bin/bash
4. Shell function
A shell script that writes a number of commands together so that the user executes a file quickly, executing multiple commands at once
5. Bash Environment
. bash_profile
Setting environment variables
Once the account is established, there is
. BASHRC
To store commands for bash
Every boot is executed
Executed after the. bash_profile
. bash_logout
Run only when exiting the registration
. Bash_histroy
Historical records
6. Format
Format: VI filename.sh use VI to write shell scripts
Script First line format: #! /bin/bash
Symbol #! The parser that is used to specify the script file. When the script is edited, the execution script must also use its Executable property, that is: chmod+x filename and then execute./filename.sh
The second method of execution:/bin/bash filename.sh
7. Precautions
Chmod+x file plus execute permission, otherwise you will be prompted for no EXECUTE permission
When executing a script or full directory, or,./file.sh, if not added, Linux defaults to find file.sh from path
After the script suffix is modified, it will still work
Shell Programming-Introduction (I.)