1.!#/bin/bash
This is the first line of the shell script, and/bin/bash represents the location of the script's interpreter.
2. Run the script:
(1) Bash test.sh
(2) Bash-x test.sh (ps:-x for observing script running state)
(3) Release script permissions: [1] chmod +x test.sh [2]./test.sh
3. Shell's built-in commands (commands provided by Bash itself, not executable files):
- Type: Determine if a command is a built-in command (Ps:type CD)
- Alias: Create aliases for commands (Ps:alias ll= ' ls-l--color=tty ')
- Jobs: View paused tasks (pause with Ctrl + Z)
- BG 2: Put suspended task 2 in background run
- FG 2: Place background Task 2 in foreground run
- Declare-i num=1: Defines an integer num
- Declare-r num=1: Top one-only reading num
- Declare-a arr= ' ([0]= "a" [1]= "B" [2]= "C") '
- Declare-f: Displaying functions in a script
- Declare-f: Displays the function body in the script
- Export var=100: Import variables from the parent shell into the child shell (the child shell recognizes the variables defined in the parent shell)
- Let m=15%7: integer operations, support subtraction, i++,i--, and a series of integer algorithms
- PWD: Displays the current working path
- Read N: Reads a line from the standard input to the variable n (declare n read n)
- Ulimit: Display and set process resource scheduling (ulimit-a to show all process resources)
Shell built-in commands and operating methods