shell切分字符串到数组

  发布时间:2025-11-05 06:51:55   作者:玩站小弟   我要评论
解决方法1:#!/bin/=’,,,,=${element$ 。

解决方法1:

#!/bin/=’,分字符串,,,=${ element  $

解决方法2:

#!/bin/bash user="aa:bb is ok:/home/work"i=1while((1==1))do  split=`echo $user|cut -d ":" -f$i`   if [ "$split" != "" ]; then     ((i++))     echo $split   else    break  fi done

http://shenzhen.offcn.com/

  • Tag:

相关文章

最新评论