Knowledge Points:
Array
function Local Variables
Defining pass-through parameters
Example 1:
A= (1 2 3) b= (a B c) function () {Local a=$1 local b=$2 for I in $a does echo $i done Ech o $b}funcition "${a[*]}" "${b[*]}" Result: 123a b C difference: ${a[*]} is passed in a parameter, "1 2 3" ${a[@]} is passed in multiple parameters, "1", "2", "3"
Example 2:650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background-image:url ("/e/u261/lang /zh-cn/images/localimage.png "); background-position:center;background-repeat:no-repeat;border:1px solid RGB ( 221,221,221); "alt=" Spacer.gif "/>
If A= (1 2 3), $a represents the first element, you can use ${a[*]} or ${a[@]}
If A= "1 2 3", you can use ${a[*]} or ${a[@]} or $ A
If A= "1 2 3", array= ($a), Equals a= (1 2 3), Test echo ${array[@]}
For ((i=0,i<${#array [@]}, i= $i + 1)) Doecho ${array[$i]) done
# # Number of Arrays ${#array [@]}
# # array element replacement array[1]= "22"
This article from the "Technology blog" blog, declined to reprint!
Shell Transfer Array Parameters!