ITPub博客

首页 > 应用开发 > > shell切分字符串到数组

shell切分字符串到数组

作者:25minutes 时间:2019-10-10 11:12:39 0 删除 编辑

解决方法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/

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4328/viewspace-3140839/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-17

  • 博文量
    336
  • 访问量
    14906