linux - 恢复 .bak 文件

标签 linux bash shell

我使用 perl 脚本运行

perl -p -i.bak -e "..." *.sh dir/*.sh

这创建了每个文件的副本,如

script.sh
script.sh.bak

我现在想从 .bak 文件中恢复。我怎样才能轻松做到这一点?

最佳答案

for file in *.sh.bak dir/*.sh.bak; do cp "$file" "${file//.bak}"; done

或者您可以使用 mv 而不是 cp

关于linux - 恢复 .bak 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10794821/

相关文章:

Linux 通讯命令

python - 在ubuntu中打开spyder

mysql - Bash 包含不工作

c++ - 使用 C++ 或 Bash/Shell 脚本评估后台 linux 命令的输出

python - 在 python 中抑制 shell 命令的详细输出

bash - 如何使用 bash 或 jq 检查 json 是否为空?

shell - (如何)是否可以仅向那些使用标准 shell 命令和/或 Unix utils 已经拥有 r 权限的人添加 x 权限?

linux - 命令列出除 . (点)和..(点点)

linux - Grep 包含 'n' 给定用户输入的字母数的单词

linux - bash 脚本 - 读取单个击键,包括特殊键输入和空格