开发者

Tokenize a string in KornShell

I need to tokenize in string in KornShell (ksh). I have got the following script for bash; but it does not seem to work in ksh.

The script is below. Please help in making work for ksh.

OLDIFS=$IFS
IFS=","
read -a array <<< "$(printf "%s" "$APPLICATION_NAMES")"
IFS=$OL开发者_如何学编程DIFS
for i in "${array[@]}"
do
   :
   # do whatever on $i
   echo "Checking status of $i"
done


# s=a,b,c
# IFS=,
# set -A arr $s
# for e in "${arr[@]}"; do print -- "$e"; done
a
b
c
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜