grep -rl "${OLD_PACKAGE_STR}" $PROJECT_PATH | xargs sed -i "" "s/${OLD_PACKAGE_STR}/${NEW_PACKAGE_STR}/g"
grep -rl "${OLD_PARAM_PREFIX}" $PROJECT_PATH | xargs sed -i "" "s/${OLD_PARAM_PREFIX}/${NEW_PARAM_PREFIX}/g"
centos 和 windows git bash 使用下面的命令
grep -rl "${OLD_PACKAGE_STR}" $PROJECT_PATH | xargs sed -i "s/${OLD_PACKAGE_STR}/${NEW_PACKAGE_STR}/g"
grep -rl "${OLD_PARAM_PREFIX}" $PROJECT_PATH | xargs sed -i "s/${OLD_PARAM_PREFIX}/${NEW_PARAM_PREFIX}/g"
报错截图
1、用modify_content.sh修改lamp-util-pro的报错如下:
$ ./modify_content.sh
sed: can't read s/top.tangyh.basic/com.zak.basic/g: No such file or directory
sed: can't read s/top.tangyh.basic/com.zak.basic/g: No such file or directory
2、用modify_content.sh修改lamp-cloud-pro-datasource-column的报错如下:
shawn@LAPTOP-I9SUOFIB MINGW64 /e/zak/script
$ ./modify_content.sh
sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory
sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory
sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory
sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory
sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory
版本信息:
JDK 版本(必填) : 1.8.0 源码版本(必填):4.11.0 lamp-cloud-pro-datasource-column MySQL(必填): 8.0.30 Nacos(必填):2.0.3
问题描述:
用modify_content.sh修改lamp-util-pro和lamp-cloud-pro-datasource-column无法正确修改 1、用modify_content.sh修改lamp-util-pro的内容如下:
!/bin/bash
该脚本用于修改文本文件中的字符串,如:将 ${OLD_PACKAGE_STR} 替换成 ${NEW_PACKAGE_STR}
TODO 请修改 NEW_PACKAGE_STR 和 NEW_STR
将包名中 top.tangyh.basic 改成 com.公司.basic , 不支持增加4级或者5级包!!!
将包名中 top.tangyh.lamp 改成 com.公司.项目 , 不支持增加4级或者5级包!!!
会将源码中 package 和 import 关键字后面的 ${OLD_PACKAGE_STR} 替换成 NEW_PACKAGE_STR
OLD_PACKAGE_STR="top.tangyh.basic" NEW_PACKAGE_STR="com.zak.basic"
OLD_PACKAGE_STR="top.tangyh.lamp"
NEW_PACKAGE_STR="com.cloud.zak"
公司名、 项目名要和 modify_file_name.sh 中的公司名、 项目名保持一致
这里会将注释、配置文件、默认的密码等改成 NEW_PARAM_PREFIX
OLD_PARAM_PREFIX="lamp-" NEW_PARAM_PREFIX="zak-"
TODO 这里修改成你要替换等项目路径
PROJECT_PATH=/Users/tangyh/Downloads/lamp-cloud-pro
PROJECT_PATH=/e/zak/script/zak-util-pro
PROJECT_PATH=/e/zak/script/zak-cloud
PROJECT_PATH=/Users/tangyh/Downloads/test/lamp-boot-plus
PROJECT_PATH=/Users/tangyh/Downloads/test/lamp-web
PROJECT_PATH=/Users/tangyh/Downloads/test/lamp-util
###############下面的请勿改动#################
这段命令用于清理项目中无用等文件
rm -rf $PROJECT_PATH/.git rm -rf $PROJECT_PATH/third-party find $PROJECT_PATH/ -name "*.iml" | xargs rm -rf find $PROJECT_PATH/ -name "target" | xargs rm -rf find $PROJECT_PATH/ -name ".DS_Store" | xargs rm -rf find $PROJECT_PATH/ -name ".idea" | xargs rm -rf
mac 使用这段命令实现替换字符串 (mac和centos的区别在于 -i 后面有没有 "")
grep -rl "${OLD_PACKAGE_STR}" $PROJECT_PATH | xargs sed -i "" "s/${OLD_PACKAGE_STR}/${NEW_PACKAGE_STR}/g"
grep -rl "${OLD_PARAM_PREFIX}" $PROJECT_PATH | xargs sed -i "" "s/${OLD_PARAM_PREFIX}/${NEW_PARAM_PREFIX}/g"
centos 和 windows git bash 使用下面的命令
grep -rl "${OLD_PACKAGE_STR}" $PROJECT_PATH | xargs sed -i "s/${OLD_PACKAGE_STR}/${NEW_PACKAGE_STR}/g"
grep -rl "${OLD_PARAM_PREFIX}" $PROJECT_PATH | xargs sed -i "s/${OLD_PARAM_PREFIX}/${NEW_PARAM_PREFIX}/g"
2、用modify_content.sh修改lamp-cloud-pro-datasource-column的内容如下:
!/bin/bash
该脚本用于修改文本文件中的字符串,如:将 ${OLD_PACKAGE_STR} 替换成 ${NEW_PACKAGE_STR}
TODO 请修改 NEW_PACKAGE_STR 和 NEW_STR
将包名中 top.tangyh.basic 改成 com.公司.basic , 不支持增加4级或者5级包!!!
将包名中 top.tangyh.lamp 改成 com.公司.项目 , 不支持增加4级或者5级包!!!
会将源码中 package 和 import 关键字后面的 ${OLD_PACKAGE_STR} 替换成 NEW_PACKAGE_STR
OLD_PACKAGE_STR="top.tangyh.basic"
NEW_PACKAGE_STR="com.zak.basic"
OLD_PACKAGE_STR="top.tangyh.lamp" NEW_PACKAGE_STR="com.cloud.zak"
公司名、 项目名要和 modify_file_name.sh 中的公司名、 项目名保持一致
这里会将注释、配置文件、默认的密码等改成 NEW_PARAM_PREFIX
OLD_PARAM_PREFIX="lamp-" NEW_PARAM_PREFIX="zak-"
TODO 这里修改成你要替换等项目路径
PROJECT_PATH=/Users/tangyh/Downloads/lamp-cloud-pro
PROJECT_PATH=/e/zak/script/zak-util-pro
PROJECT_PATH=/e/zak/script/zak-cloud
PROJECT_PATH=/Users/tangyh/Downloads/test/lamp-boot-plus
PROJECT_PATH=/Users/tangyh/Downloads/test/lamp-web
PROJECT_PATH=/Users/tangyh/Downloads/test/lamp-util
###############下面的请勿改动#################
这段命令用于清理项目中无用等文件
rm -rf $PROJECT_PATH/.git rm -rf $PROJECT_PATH/third-party find $PROJECT_PATH/ -name "*.iml" | xargs rm -rf find $PROJECT_PATH/ -name "target" | xargs rm -rf find $PROJECT_PATH/ -name ".DS_Store" | xargs rm -rf find $PROJECT_PATH/ -name ".idea" | xargs rm -rf
mac 使用这段命令实现替换字符串 (mac和centos的区别在于 -i 后面有没有 "")
grep -rl "${OLD_PACKAGE_STR}" $PROJECT_PATH | xargs sed -i "" "s/${OLD_PACKAGE_STR}/${NEW_PACKAGE_STR}/g"
grep -rl "${OLD_PARAM_PREFIX}" $PROJECT_PATH | xargs sed -i "" "s/${OLD_PARAM_PREFIX}/${NEW_PARAM_PREFIX}/g"
centos 和 windows git bash 使用下面的命令
grep -rl "${OLD_PACKAGE_STR}" $PROJECT_PATH | xargs sed -i "s/${OLD_PACKAGE_STR}/${NEW_PACKAGE_STR}/g"
grep -rl "${OLD_PARAM_PREFIX}" $PROJECT_PATH | xargs sed -i "s/${OLD_PARAM_PREFIX}/${NEW_PARAM_PREFIX}/g"
报错截图
1、用modify_content.sh修改lamp-util-pro的报错如下: $ ./modify_content.sh sed: can't read s/top.tangyh.basic/com.zak.basic/g: No such file or directory sed: can't read s/top.tangyh.basic/com.zak.basic/g: No such file or directory
2、用modify_content.sh修改lamp-cloud-pro-datasource-column的报错如下: shawn@LAPTOP-I9SUOFIB MINGW64 /e/zak/script $ ./modify_content.sh sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory sed: can't read s/top.tangyh.lamp/com.cloud.zak/g: No such file or directory
重现步骤
支持一下
如果该issue帮助了你, 麻烦给项目点个star, 并给当前issue回复一下 “👍” 或者 “已解决”.