Whole history of bash There is no such file or directory error in directories with spaces

I am trying to implement the functionality described in the blog article " All bash history revised ." Basically what the scripts allow you to do is to keep your entire bash history forever and in multiple sessions.

Someone kindly made all the code readily available on Github .

However, whenever I use a directory with spaces:

cd ~/Desktop/
mkdir "dir with spaces"
cd dir\ with\ spaces/

the next time I log in, I get the following errors:

-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

The only link I understood did not seem to cause a problem:

# Now change to the new dir and add to the top of the stack
pushd "${the_new_dir}" > /dev/null

I hope some bash scripting expert can point out an error in the code so that I can fix it.

+5
source share
1 answer

:

for x in `hd 20` `pwd`; do cd_func $x ; done

:

( hd 20; pwd ) | while read x; do cd_func "$x"; done

, github.

+4

All Articles