【发布时间】:2014-02-10 20:42:23
【问题描述】:
我正在编写一个非常简单的脚本,它将与我的 git 存储库进行交互,但我已经到了一个点,我无法弄清楚为什么会发生以下情况。
拥有:
destPath='~/Dropbox/Shared/Alex\&Stuff'
destFile='file.zip'
#git archive --format zip --output $destFile master
echo $destPath/$destFile
rm $destPath/$destFile
echo 输出正确的路径:
~/Dropbox/Shared/Alex\&Stuff/file.zip
但是 rm 失败并显示以下内容:
rm: cannot remove ‘~/Dropbox/Shared/Alex\\&Stuff/file.zip’: No such file or directory
那么,为什么在执行rm 时要添加额外的反斜杠呢? Alex\\$Stuff 而不是 Alex\$Stuff ?
【问题讨论】: