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

 

posted on 2016-08-25 15:19  IT小不点  阅读(570)  评论(0编辑  收藏  举报