所有bash历史记录在带有空格的目录上没有此类文件或目录错误
我一直在尝试实现博客文章“”中描述的功能。基本上,这些脚本使您能够永久保存所有bash历史记录,并跨越多个会话 有人善意地制作了所有代码 但是,每当我使用带有空格的目录时:所有bash历史记录在带有空格的目录上没有此类文件或目录错误,bash,.bash-profile,Bash,.bash Profile,我一直在尝试实现博客文章“”中描述的功能。基本上,这些脚本使您能够永久保存所有bash历史记录,并跨越多个会话 有人善意地制作了所有代码 但是,每当我使用带有空格的目录时: cd ~/Desktop/ mkdir "dir with spaces" cd dir\ with\ spaces/ 下次登录时,我会收到如下错误: -bash: pushd: /Users/jack/Desktop/dir: No such file or directory -bash: pushd: with: N
cd ~/Desktop/
mkdir "dir with spaces"
cd dir\ with\ spaces/
下次登录时,我会收到如下错误:
-bash: pushd: /Users/jack/Desktop/dir: No such file or directory
-bash: pushd: with: No such file or directory
-bash: pushd: spaces: No such file or directory
我所理解的唯一参考似乎并没有引起问题:
# Now change to the new dir and add to the top of the stack
pushd "${the_new_dir}" > /dev/null
我希望一些bash脚本专家能指出代码中的错误,这样我就可以修补它。这就是罪魁祸首:
for x in `hd 20` `pwd`; do cd_func $x ; done
替换为:
( hd 20; pwd ) | while read x; do cd_func "$x"; done
在github repo上发出的请求。不确定,但尝试使用
新目录=“$1”
而不是新目录=$1
@nneonneo quoting在任务右侧的扩展上不需要。在那里不会发生分词。是否有可能在您的.bashrc中有其他东西阻塞了目录名?