Shell script reception parameters

test.sh

#!/bin/bash

echo
"Script name$0"
echo
"The first parameter $1"
echo
"The second parameter $2"
echo
"The third parameter $3"
echo
"The fourth parameter $4"
echo
"The fifth parameter $5"
echo
"The sixth parameter $6"
echo
"The seventh parameter $7"
echo
"The eighth parameter $8"
echo
"The ninth parameter $9"
echo
"The tenth parameter ${10} "
echo
"The 11th parameter ${11} "

Output

bogon:Desktop macname$. /test.sh abcdefghijk

Script name.
/test.sh
The first parameter a
The second parameter b
The third parameter c
The fourth parameter d
The fifth parameter e
The sixth parameter f
The seventh parameter g
The eighth parameter h
The ninth parameter i
The tenth parameter j
The eleventh parameter k

Reference:

https:/ /blog.csdn.net/sinat_36521655/article/details/79296181

#!/bin/bash

echo
"Script name$0"
echo
"The first parameter $1"
echo
"The second parameter $2"
echo
"The third parameter $3"
echo
"The fourth parameter $4"
echo
"The fifth parameter $5"
echo
"The sixth parameter $6"
echo
"The seventh parameter $7"
echo
"The eighth parameter $8"
echo
"The ninth parameter $9"
echo
"The tenth parameter ${10} "
echo
"The 11th parameter ${11} "

bogon:Desktop macname$ ./ test.sh abcdefghijk

Script name.
/test.sh
The first parameter a
The second parameter b
The third parameter c
The fourth parameter d
The fifth parameter e
The sixth parameter f
The seventh parameter g
The eighth parameter h
The ninth parameter i
The tenth parameter j
The 11th parameter k

Leave a Comment

Your email address will not be published.