简体   繁体   中英

Fish shell cd using relative path return: The directory “whatever” does not exist

I'm having trouble with a basic behavior of cd in fish shell.

cd to relative directory

I'm willing to change directory using a relative path without the ./ . The directory exists:

❯ ls
addons/  custom-addons/  docker-compose.yml  

The directory is auto-completed, yet I can't change to it:

❯ cd addons/
cd: The directory “addons/” does not exist

CDPATH

set -gx CDPATH $CDPATH $HOME/projects

As described in the documentation section Special Variables :

CDPATH , an array of directories in which to search for the new directory for the cd builtin. By default, the fish configuration defines CDPATH to be a universal variable with the values . and ~ .

Diagnostic

I was overriding the default value while omitting . and ~ value.

Solution

Adding them back solved the issue, in ~/.config/fish/config.fish :

set -gx CDPATH $CDPATH . ~ $HOME/projects

Then reload fish with:

exec fish

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM