ITPub博客

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

shell切分字符串到数组

作者:u_509a2a8fdb46 时间:2019-10-08 13:57:08 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

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

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

注册时间:2019-08-08

  • 博文量
    210
  • 访问量
    38