Shell script variable $#,$*,$$,$@,$0,$1,$2,$? meaning __shell Script

Source: Internet
Author: User
Parameter description

1:$# indicates the number of incoming arguments executed by the script

2:$* indicates that the execute script passes in the argument list

3:$$ represents the Process ID

4:$@ indicates that the execute script passed in all parameters

5:$0 to execute script name

6:$1 represents the first parameter

7:$2 represents a second parameter

8:$? Indicates that script execution state 0 is normal, others indicate error experiments and results

#!/bin/sh

echo "Parm number is: $#"
echo "Parm list is: $*"
echo "All Parm are: $@"

echo "process is: $$"

echo "File name is: $"
echo "The" "the" the "the" is: $ "
echo "stat is: $?"


-----------------------------Implementation and Results------------------------------

Execution: Sh shelltest.sh "The" the "the" "The Parm" "The second Parm"


Parm number Is:2
Parm list is:the Parm second Parm
All Parm is:the parm second Parm
Process is:28669
File name is:shellTest.sh
The Parm is:the-A-parm
Stat is:0



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.