#!/bin/bash : [DEBUG] set param readonly SCORE_ARRAY=(100 90 80 70) readonly COUNTS=${#SCORE_ARRAY[@]} function cal_score_ave() { local _score_sum=i : [DEBUG] cal for _score in ${SCORE_ARRAY[@]} do _score_sum=$((_score_sum + _score)) done score_ave=$((_score_sum / COUNTS)) return 0 } : [DEBUG] main cal_score_ave echo $score_ave echo $param echo "finished" exit 0 # bash -uvx cal_score_ave.sh #!/bin