linux shell批量重名了java 类
linux shell批量重名了java 类
所以的单元测试类,名称后面添加Test
即把Student.java ,改为StudentTest.java
#!/bin/bash for i in `find /Users/whuanghkl/work/shop/src/test/java/com/ -type f -name "*.java"| sed 's#\.java$##'`;do fileSimpleName=`echo $i|sed 's#^.*/##'` #去掉目录 suffix22=`echo $fileSimpleName |sed '/Test$/d'` #判断文件名称是否以Test结尾 if [ ! -s $suffix22 ]; then echo "aa" echo $suffix22 echo "fileSimpleName:$fileSimpleName" #Student ,没有.java echo $i.java sed -i "" "s/$fileSimpleName/${fileSimpleName}Test/g" $i.java mv $i.java ${i}Test.java fi done
注意:
(1)mac中 sed -i 后面要增加空字符串
(2)mac中,xargs的用法也不太一样
find . -iname *something* | xargs -I {} mv {} ../Other/Location
find ./ -type f -iname "*.json"|sed 's/json$//' |xargs -I {} mv {}json {}xml
相关推荐
laisean 2020-11-11
Julyth 2020-10-16
laisean 2020-09-27
flycappuccino 2020-09-27
liguojia 2020-09-27
87201442 2020-10-15
MXstudying 2020-09-05
WasteLand 2020-09-15
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh
mathchao 2020-09-15
tvk 2020-07-30
Zaratustra 2020-07-29
zhaowj00 2020-07-26
Zaratustra 2020-06-26
ldcwang 2020-06-25
拿什么来拯救自己 2020-06-21
IsanaYashiro 2020-06-16
赵家小少爷 2020-06-14
大牛牛 2020-06-14