【发布时间】:2019-07-21 13:21:37
【问题描述】:
在我的 .bashrc 中,我使用 .sh 脚本来轻松配置新安装的 Debian。但是在尝试
rm -f ~/.bash_aliases
wget https://raw.githubusercontent.com/.../.bash_aliases
rm -f ~/.bashrc
wget https://raw.githubusercontent.com/.../.bashrc
只是省略了那些行?
文件具有chmod +x ./script.sh 的权限并由sudo ./script.sh 运行
什么可能是错的?
(在最终代码中有完整链接,文件正在下载为.bashrc.1 和.bash_aliases.1)
【问题讨论】:
-
这里没有确凿的证据表明行没有正在运行。运行
bash -x yourscript让脚本在运行时记录它运行的每个命令。 -
...也就是说,如果你想覆盖这些文件,我既不会使用
rm也不会使用wget。使用curl --fail -o ~/.bash_aliases https://...whatever.../.bash_aliases; curl 的行为通常比 wget 的更可预测且脚本友好。