随笔 - 210  文章 - 0  评论 - 11  阅读 - 43万

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   IT小不点  阅读(574)  评论(0编辑  收藏  举报
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示