1. Bash = Bourne Again SHell
2. Terminal prompt:
#普通用户 [email protected]$ #管理员用户 [email protected]#
3. The shell script is usually a text file that starts with Shebang:
#! /bin/bash
Shebang is a line of text where #! is before the interpreter path. /bin/bash is the command path of the BASH interpreter.
In Unix jargon, the character "#" is usually read as "sharp" or "hash" or "mesh" to address the exclamation point "!" Called Bang, "shebang" means that the two words match up "#! ”。
4. Write the string to text:
echo "This is a sample text!" > Temp.txt
Insert a string after the text:
echo "This is another sample text!" >> temp.txt
To view the contents of a text file:
Cat Temp.txt
REDIRECT error message stderr to text:
$ ls + 2> OUT.txt
LS + is an error statement, "2>" is a stderr redirect.
/dev/null is a special device file, and any data it receives will be discarded and called a device black hole. Data is gone.
5. Generate the delay in the script:
#! /bin/bashecho-n count:tput sccount=0;while true;do If [$count-lt]; then let count++; Sleep 1; Tput RC tput ed echo-n $count; else exit 0; Fidone
Linux Shell Learning Note 00