jetsung sh 按 ; 拆分字符串 仅打印 ABC="a;b;c" echo "$ABC" | awk -F ';' '{ for (i = 1; i <= NF; i++) print $i }' 先切分成 \n 换行方式,再调用自定义函数 ABC="a;b;c;d" test() { echo "test: $1"; } echo "$ABC" | tr ';' '\n' | while read -r T; do test "$T"; done