#!/bin/bash ax=1,2 ax_2=${ax//,/ } #=>把,替換爲空格 ax_3=${ax//,/*} #=>把,替換爲* echo $ax #1,2 echo $ax_2 #1 2 echo $ax_3 #1*2 ax_2_2=(${ax//,/ }) #=>把,替換爲空格,並轉化爲數組 echo $ax_2_2 #1 echo ${ax_2_2[0]} #1 echo ${ax_2_2[1]} #2