$cat gg.sh 
#! /bin/bash
exit=([0]="apple orange" [1]="pear")
relay=([0]="apple orange" [1]="pear")
function gg() {
        tmp=$1
        echo ${tmp[0]} 
        echo ${tmp[1]} 
        tmp=$2
        echo ${tmp[0]} 
        echo ${tmp[1]} 
        for i in ${tmp[*]}; do
                echo $i
        done
}
gg "${exit[*]}" "${relay[*]}"
$./gg.sh $apple orange pear $ $apple orange pear $
$apple
$orange
$pear
#双引号传参失败
原文:https://www.cnblogs.com/toughcactus/p/15007839.html