PASS Parameters through shell in SQL

Source: Internet
Author: User

Transfer

1. location parameters
The parameters provided by the system are called location parameters. The value of the location parameter can be obtained using $ N. N is a number. If it is 1, it is $1. It is similar to the number in C language.
In Linux, the input command string is segmented and each segment is labeled with a label starting from 0. No. 0thProgramName, which indicates the parameter passed to the program from 1. For example, $0 indicates the program name.
$1 indicates the first parameter passed to the program, and so on.
2. Internal Parameters
In the above process, $0 is an internal variable, which is mandatory, while $1 is dispensable. There are several internal variables that are the same as $0.
$ # ---- Total number of parameters passed to the program
$? ---- PreviousCodeOr the shell program exits in the shell. If it Exits normally, 0 is returned. Otherwise, it is not 0.
$ * ---- A string consisting of all parameters passed to the program.
$ N ---- indicates the first parameter, $1 indicates the first parameter, and $2 indicates the second parameter...
$0 ---- name of the current program
$ @ ---- Save all parameters in the form of "parameter 1" "parameter 2 "...
$ ---- PID of the Program (process ID)
$! ---- PID of the previous command

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.