Bibliography:Guide to shell script learning, compiled by o'reilly Taiwan by Arnold Robbins & Nelson H. F. Beebe, published by Mechanical Industry Press
P24:
By default, when a shell execution has an executable attribute"ProgramThe shell will require the kernel to start a new process to execute this program. However, the kernel can only execute "compiled executable files", but cannot execute script files, as a result, kernel will respond to shell "this is not an executable file", so shell will treat this file as a shell script file of the corresponding version by default, and start a new shell copy to explain and execute it-so even if a script file is not as common as the first line#! ......
The identifier and shell can also be interpreted and executed, but this does not conform to the specification and cannot be used by other script language interpreters.
In #! When specifying the interpreter program, you can also add parameters that need to be passed to the interpreter, for example #! /Bin/sh-F, or #! /Bin/sh-. The latter indicates that no shell option parameter is specified, which is mainly used to ensure security.
P2:
On the same command line, the semicolon is used to isolate different commands. Shell will execute these commands in sequence. Whether there are spaces before and after the semicolon is not sensitive
P28:
Shell executable Commands include built-in commands, Shell functions, and external commands. The execution of the script program is called an external command. This shell is executed by creating a new copy of the shell process. If there is no & background execution mark, the parent shell waits for the command to be executed, that is, after the command is executed, the control is returned to the parent shell.
P29:
By default, the echo command outputs a line break when ECHO-N ...... The line break will be omitted, and the-e parameter under Ubuntu will make the escape characters in the ECHO content
P31:
The printf command in shell is similar to the Standard C library function printf, that isPrintf "format-string" [arguments...]
P32:
Every program has the concept of standard input, standard output, and standard error output, and the application does not need to care about what physical devices correspond to the three. That is what the OS is. In Unix-like environments, the default stdin, stdout, and stderr all correspond to terminal devices.
Use the cat command on the shell command line to verify the situation of stdin, stdout, and stderr.
P33:
Common cat> file can be easily redirected through standard output to get the file text file from terminal input. When the input is complete, Ctrl-D is used to indicate that the input is complete.
P34:
The TR command can be used to quickly replace, delete, and compress characters. Common options include-D,-S, and-C.
P35 ~ 36:
/Dev/null is often used to block the output content. It is useful when you only need to get the exit status of a command operation and do not need to print the content;
Stty-echo: Disable the display of input characters on the terminal;
SpO2:
Set-X enables command execution tracking in the Current Shell environment, and set + x disables tracking;
You can use sh-X file to enable the execution tracking function in the newly created shell process (that is, in the shell environment where the file is executed ).
P40:
Use the locale command to display the values of the current language and culture environment variables, including Lang, lc_ctype, and lc_time, use locale-ck LC _ ** to view the variable details in the current language and culture environment.
P44:
In the POSIX system, there are two regular expression styles bre and ere. For the new grep tool, both styles can be adapted.