shell 分词

  

#########################################################################
# File Name: hello.sh
# Author: lukey
# mail: lukey123@foxmail.com
# Created Time: Thu 25 Aug 2016 01:56:03 PM CST
#########################################################################
#!/bin/bash
case="hello,world,both,byebye ohoh"

cat -etv <<<"$IFS"
    
echo "case:$case"
IFS=,
cat -etv <<<"$IFS"
echo $IFS
arr=($case)
#echo ${arr}
for s in ${arr[@]};do
    echo "worrrd:$s"
done

for s in $case; do
    echo "word:$s"
done
原文地址:https://www.cnblogs.com/luolizhi/p/5806966.html