Note--shell Scripting Learning Guide

Source: Internet
Author: User

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

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.