Parameter references in the shell

Source: Internet
Author: User

Reference parameters Describe
0,1,2. Positional parameters. Start with the parameter 0. The parameter 0 references the name of the Startup bash program, and if the function runs in the shell script, the name of the shell script is referenced. Strings that are caused by single or double quotation marks are passed as a parameter, and the quotation marks are removed when passed. In the case of double quotes, shell variables such as $home are extended before the function is called. For parameters that contain embedded white space or other characters, you need to use either single or double quotation marks for delivery.
* Displays all parameters passed to the script in a single string, which can be more than 9 parameters, unlike positional variables.
@ Starting with parameter 1, all parameters passed to the script are displayed. If you extend in double quotes, each parameter becomes a word, so "[email protected]" is equivalent to "$" "$". This form is used if the parameter has the potential to contain embedded whitespace.
# Number of parameters (not including parameter 0)
$ The current process ID number for the script to run
! ID number of the last process that the script runs
? Displays the exit status of the last command, 0 means no error, and any other value indicates an error
- Displays the current options used by the shell, the same as the SET command function.


Parameter references in the shell

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.