#!/bin/bash # array variable to function test function testit { local newarray newarray=("$@") echo "The new array value is: ${newarray[*]}" } myarray=( ) echo "The original array is ${myarray[*]}" testit ${myarray[*]} 注意: fu…
写在前面:案例.常用.归类.解释说明.(By Jim) 使用函数 #!/bin/bash # testing the script function myfun { echo "This is an example of a function" } count=1 while [ $count -le 5 ] do myfun count=$[ $count +1 ] done echo "This is the end of the loop" myfun ech…
使用函数 #!/bin/bash # testing the script function myfun { echo "This is an example of a function" } count=1 while [ $count -le 5 ] do myfun count=$[ $count +1 ] done echo "This is the end of the loop" myfun echo "Now this is the end…