您现在的位置是:亿华云 > IT科技

shell切分字符串到数组

亿华云2025-10-03 15:56:16【IT科技】7人已围观

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

很赞哦!(42452)