用于将 base_url 添加到 php 文件的 Shell 脚本

标签 shell scripting ubuntu rename

我有一个网站设置,其中有很多文件,主要是 php.ini。但是在这里我将文件称为/model/login/......

我想将所有此类事件重命名为 $base_url/model/login/....

我该如何解决这个问题,或者我在哪里可以获得相同的教程。

最佳答案

sed只要您不将路径用于代码中的其他任何内容,就可以轻松地做到这一点。

sed -i 's!/model/login/!$base_url&!g' foo.php

关于用于将 base_url 添加到 php 文件的 Shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4311399/

相关文章:

linux - 使用 sed 提取子表达式

linux - 如何在shell脚本中扩展变量?

gradle - 如何抑制 gradle 的所有输出?

scripting - 检查脚本是否在 AutoHotkey 中暂停

apache - 配置 Apache 将 "GET/user/foo"路由到/user/GET.php 并将 "PUT/user/foo"路由到/user/PUT.php

linux - 使 shell 脚本在启动时作为守护进程运行

Python 脚本 : Print new line each time to shell rather than update existing line

windows - *.bat 和 *.cmd 文件有什么区别?

python - 如何在不重新启动机器的情况下修复 torch.cuda.is_available() False 问题?

ubuntu - Nginx/phpfpm 不显示更新的内容