shell 分词

时间:2021-09-15 05:03:15

  

#########################################################################
# File Name: hello.sh
# Author: lukey
# mail: lukey123@foxmail.com
# Created Time: Thu Aug :: 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