Shell Scripting Study Guide Mechanical industry publishing ISBN 987-7-111-25504-8
2nd Chapter
2.4
Primary traps
1. Today's systems, for #! The length limit for this line is from 63 to 1024 characters, try not to exceed 64 characters.
2. On some systems, the command-line section contains the full path name of the command. Some systems do not, however, and the command line part is passed to the referenced program intact.
3. Do not place any whitespace after the option, as the whitespace is also passed along with the option to the referenced program.
4. You need to know the full path name to explain it. This can be used to circumvent portability problems, because different vendors may put the same things in different places.
5. On some older systems, the kernel does not have an explanation #! And some shells are automatically handled by the shell for #! There can be a gap between the name of the interpreter that is immediately behind it, and there may be different interpretations.
2.5.5
TR [Options] source-char-list replace-char-list
Purpose: Converts characters. For example, convert uppercase characters to lowercase. option allows you to specify the characters you want to delete, and to condense the inherited characters into one.
Common options:
-C take Source-char-list's inverse meaning. TR the character to be converted into a character that is not listed in the source-char-list. This option is typically used in conjunction with-D or-S.
-C is similar to-C, but handles characters rather than binary byte values.
-D self-standard input removes the characters listed in Source-char-list instead of converting them
-S condensed duplicate characters. If the characters listed in Source-char-list are repeatedly repeated in the standard input, they are condensed into one.
Special documents:/dev/null and/dev/tty
/dev/null bit barrels. Data sent to this file will be discarded by the system. That is, when a program writes data to a secondary file, it thinks it has finished writing the data, but actually does nothing.
/dev/tty when the program opens the file, Unix automatically redirects it to a terminal and then binds to the program.
Note--shell Scripting Learning Guide