24 lines
608 B
Bash
24 lines
608 B
Bash
#!/bin/bash
|
|
|
|
# 定义搜索的文件夹路径
|
|
root_dir="00-docker-compose"
|
|
|
|
# 定义要搜索的字符串
|
|
search_string="172.20.32.234"
|
|
|
|
# 定义要替换的新字符串
|
|
replace_string="172.20.32.202"
|
|
|
|
# 检查根目录路径是否存在
|
|
if [ ! -d "$root_dir" ]; then
|
|
echo "指定的根目录路径不存在:$root_dir"
|
|
exit 1
|
|
fi
|
|
# 搜索并替换文件夹中所有文件的内容
|
|
echo "开始搜索并替换文件夹中的字符串..."
|
|
find "$root_dir" -type f -exec sed -i "s/$search_string/$replace_string/g" {} +
|
|
|
|
cp -rf 00-docker-compose/forgeplus/* forgeplus/
|
|
|
|
echo "搜索并替换完成。"
|