Shell修改 info.plist 参数值

487 阅读1分钟
通过shell 修改 info.plist 参数值 适用于 构建自动化打包
#plist 文件路径
plist="info.plist"

  

# item 参数   参数所在的行数
grep -np "item" $plist                                     

 #:分割分组,打印第一个变量值加1,得到目标行数
grep -np "item" $plist | awk -F ':' '{print $1+1}'        

#$(命令),计算命令执行结果
Line=$(grep -np "item" $plist | awk -F ':' '{print $1+1}') 

  
itemString=$(sed -n "${ServiceLine}p" $plist | awk -F ':' '{print $1}')

echo $stri

itemString=`echo $itemString | sed -e 's/<\/string>//g'`

itemString=`echo $itemString | sed -e 's/<string>//g'`

**echo** "123+$itemString"


sed -i "" "s/$itemString/$item/" $plist