Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
所有bash历史记录在带有空格的目录上没有此类文件或目录错误_Bash_.bash Profile - Fatal编程技术网

所有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

我一直在尝试实现博客文章“”中描述的功能。基本上,这些脚本使您能够永久保存所有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: 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中有其他东西阻塞了目录名?