#!/bin/bash
iosBatchLazyCode(){
if test $1 = "UIButton" ; then
str="[$1 buttonWithType:UIButtonTypeCustom];"
else
str="[[$1 alloc]init];"
fi
echo -e "
- ($1 *)$2{
if (_$2 == nil) {
_$2 = $str
}
return _$2;
}"
}
#追加一行空格
echo -e '\n' >> propertys.txt
#读取文件存数组
i=0
while read line
do
lineStr=$line
noneSpaceStr=${lineStr// /}
ARR[$i]=$noneSpaceStr
let i+=1
done < propertys.txt
#格式化输出到out.txt
for str in ${ARR[*]}
do
a=${str#*)}
b=${a%"*"*}
c=${str#*"*"}
d=${c%*;}
iosBatchLazyCode $b $d
done >> out.txt
shell脚本学习
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。