Go Description of special positional parameter variables commonly used by shell

Source: Internet
Author: User

Description of special positional parameter variables commonly used by shell

Original: http://m.blog.itpub.net/15498/viewspace-2151142/

$ $ Gets the file name of the currently executing shell script, including the script path if the execution script contains the path
The $n gets the nth parameter value of the currently executing shell script, n=1..9, which represents the file name of the script when n is 0, or if n is greater than 9, enclosed in curly braces, such as ${10}, and the arguments are separated by spaces
$# gets the total number of parameters that are followed by the currently executing shell script
$* gets the arguments for all parameters of the current shell script, without quotation marks and [email protected], if you add double quotes to $*, such as "$*", all parameters are treated as a single string, equivalent to "$ $ $"
[Email protected] Gets the arguments for all parameters of the current shell script, without quotes and $*: If you add double quotes to $@, such as "[email protected]", all parameters are treated as separate strings, equivalent to "$" "$" $ 3 "" ... ". This is the best way to pass multiple arguments to other programs because it preserves any whitespace embedded in each parameter. When "[email protected]" and "$*" are both double quotes, there is a difference between the two, without double quotation marks when there is no difference.
$ Gets the return value of the last instruction executed by the current shell script

Go Description of special positional parameter variables commonly used by shell

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.