Shell Script-tips

Source: Internet
Author: User

1. Internal parameters

The above process is an internal variable, which is required to represent the program itself, and $ $ is optional. The same internal variables as $ A are as follows.

$#----The total number of parameters passed to the program is $? ----The previous code or shell program exits in the shell, returns 0 if normal exits, or a non-0 value. $*----A string that consists of all the arguments passed to the program. $----- provide the option $ when the shell starts or uses the SET command? -------- The current shell's process number $! ------------ positional parameter value, N for position $0 ----Current shell name

2. Quotation marks

Single quotes: Turns off all special symbols used and interpreted in the shell, that is, the contents of single quotes are all used and interpreted in terms of ordinary characters, whether special characters $ or escaped characters Fu Di quotes: Close most of the special symbols in the shell, but some reservations, such as $, escape characters \ (not included, \ t, etc.), anti-quote characters, and so on.  The single quote character is used as a normal character in double quotes, and does not function as above. Reverse quotation marks: command substitution, which executes the string as a shell command, and returns the execution result of the command. and the symbol $ () in the same role.

Shell Script-tips

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.