课后作业:
root@linux:~/shell# cat qh.sh
#!/bin/bash
function sum_array()
{local brr=($*) local sum=0for i in ${brr[*]} dosum=$((sum + i))doneecho $sum
}
arr=(1 2 3 4 5)
result=$(sum_array ${arr[*]})
echo "数组的和为: $result"
#!/bin/bash
function fun()
{gid=`id -g`uid=`id -u`echo "$gid $uid"
}
id=`fun`
echo $id
思维导图: