1. After opening the terminal prompt, $ represents a normal user, #表示管理员用户root, root is the most privileged user in the Linux system.
2. A shell script is usually a text file with a #! start, where #! precedes the interpreter path. Example: #!/bin/bash
3. Note section starts with #, and consistently continues to the end of the line
4. By default, Echo adds a line break after each call. The text after echo can be enclosed in double quotation marks, with single quotation marks, or without single and double quotation marks.
Note: When using the unquoted echo, you cannot use a semicolon (;) in the text that you want to display, because the semicolon is used as a command delimiter in bash.
B. Variable substitution is not valid in single quotation marks, and single quotation marks print out text as is.
5. printf uses a formatted string, you can specify the width of the string, left-right alignment, and so on. By default, printf does not automatically add line breaks like the echo command.
For example: printf "%-5s%-10s%-4s\n" No name mark result No name Mark
printf "%-5s%-10s%-4.2f\n" 3 Jim 77.564 results for 3 Jim 77.56
%-5s indicates a string substitution with a left-aligned format and a width of 5
Linux Shell Scripting Raiders Review