1 Star 0 Fork 0

houmingzhang/mycommand

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
uk_changejsondir 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
houmingzhang 提交于 2022-02-02 14:42 +08:00 . 脚本工具
#!/bin/bash
function replacesplash(){
str=$1
newstr=""
for((i=0;i<`expr length $str`;i++));
do
ch=${str:i:1}
if [ $ch == '/' ];then
newstr+='\'
newstr+=$ch
else
newstr+=$ch
fi
done
echo $newstr
}
if [ $# != 2 ] ; then
echo -e "\e[1;31m 参数错误 \e[0m"
echo "USAGE: $0 原来的路径 新的路径"
echo "------------eg.$0 MediaStoreHouse MediaStoreHouse2"
exit 1;
fi
echo "参数确认"
old_path=$(replacesplash $1)
new_path=$(replacesplash $2)
echo "----------原来路径:$1--------->$old_path"
echo "----------新的路径:$2--------->$new_path"
echo -e "\e[1;31m 1@2 找出media_cdoe的jison文件 \e[0m"
echo -e "\e[1;31m ----------------find . -name ""*.json"" -exec ls -l ""{}"" \; \e[0m"
find . -name "*.json" -exec ls -l "{}" \;
echo -e "\e[1;31m 2@2 执行路径替换 $1---->$2 \e[0m"
echo -e "\e[1;31m ----------------find . -name ""*.json"" -exec sed -i ""s/$1/$2/g"" {} \; \e[0m"
find . -name "*.json" -exec sed -i "s/$old_path/$new_path/g" {} \;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/dtrylzhm/mycommand.git
git@gitee.com:dtrylzhm/mycommand.git
dtrylzhm
mycommand
mycommand
master

搜索帮助