加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

所有bash历史记录在包含空格的目录上没有此类文件或目录错误

发布时间:2020-12-15 17:01:51 所属栏目:安全 来源:网络整理
导读:我一直在尝试实现博客文章“ All of bash history revisited”中描述的功能.基本上,脚本允许您执行的操作是永久保留所有bash历史记录并保持多个会话. 有人已经完成了所有代码easily accessible on Github. 但是每当我使用带空格的目录时: cd ~/Desktop/mkdi
我一直在尝试实现博客文章“ All of bash history revisited”中描述的功能.基本上,脚本允许您执行的操作是永久保留所有bash历史记录并保持多个会话.

有人已经完成了所有代码easily accessible on Github.

但是每当我使用带空格的目录时:

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发出拉取请求.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读