fasd_cd command not found ubuntu bash

Created on 29 Jun 2013  ·  12Comments  ·  Source: clvv/fasd

there is no fasd_cd function defined for this platform.

the following function in your bashrc will fix there errors running the z and zz error
function fasd_cd {
[ "$2" = '-i' ] && { cd fasd -id "$1" | awk '{print "$2"}'; return; }
{ cd fasd -d "$1" -1 | awk '{print "$2"}'; return; }
}

Most helpful comment

Well, I think you need eval "$(fasd --init auto)". That should work.

fasd --init auto doesn't do anything to your shell if fasd is an executable, and that is where z and fasd differ. You could, however, source fasd just like you would with z.

All 12 comments

+1, still works neither on ubuntu nor on osx for me. Has this issue made any progress?

I've been using fasd on Ubuntu for years. Works fine.

bash:
  Installed: 4.3-7ubuntu1.5
  Candidate: 4.3-7ubuntu1.5
  Version table:
 *** 4.3-7ubuntu1.5 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     4.3-6ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Here are the relevant lines from my .bashrc:

fasd_cache="$HOME/.fasd-init-bash"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
    fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache

# fasd completions
alias ei='e -i'
alias k='f -e kate'
alias l='f -e less'
alias n='f -e nano'
alias o='a -e xdg-open'
alias zi='z -i'

_fasd_bash_hook_cmd_complete ei k l n o zi

+1 Also not working on osx for me.

I'm guessing somehow the fasd_cd definition is not run in your shell rc. Please double check the installation notes and put relevant init code into your shell rc.

Added init command to shell, but it still does not work.
installed through homebrew and apt-get. This Error might be but probably is not related to the OSX El Capitan beta as I still manage to screw it up on Ubuntu.

@FranzSkuffka

  1. What shell are you using? (run echo $SHELL)
  2. Is fasd accessible by your shell? (run which fasd)
  3. Where did you put the fasd init code? Was it really sourced by your shell? Put echo test or something after fasd init code and re-open your shell again.
  4. What are the error messages, if any?

_Both machines have the same zshrc_
Ubuntu (working now, I don't know why)


[~] echo $SHELL                                                                                                                                                                               
/usr/bin/zsh
[~] which fasd                                                                                                                                                                                
/home/jan/bin/fasd
[~] fasd                                                                                                                                                                                      
...
test
[~] fasd_cd
...

no errors

OSX (not working)


[/home] echo $SHELL
/bin/zsh
[/home] which fasd
/usr/local/bin/fasd
[/home] fasd
...
test
[/home] fasd_cd
zsh: command not found: fasd_cd

That is odd. What exactly is the init command you used? fasd --init auto?

Yes

[~] fasd --init auto
{ if [ "$ZSH_VERSION" ] && compctl; then # zsh
    eval "$(fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
      zsh-wcomp zsh-wcomp-install)"
  elif [ "$BASH_VERSION" ] && complete; then # bash
    eval "$(fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install)"
  else # posix shell
    eval "$(fasd --init posix-alias posix-hook)"
  fi
} >> "/dev/null" 2>&1
[~] fasd_cd
zsh: command not found: fasd_cd

However, this issue is not urgent to me, I stick with rupa's z until this is resolved. Will provide more information if needed though.

Well, I think you need eval "$(fasd --init auto)". That should work.

fasd --init auto doesn't do anything to your shell if fasd is an executable, and that is where z and fasd differ. You could, however, source fasd just like you would with z.

echo 'eval "$(fasd --init auto)"' >> ~/.zshrc
source ~/.zshrc

change zshrc to bashrc if you use bash

It works for me now. My error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pearofducks picture pearofducks  ·  7Comments

ixil picture ixil  ·  5Comments

josephholsten picture josephholsten  ·  15Comments

sindresorhus picture sindresorhus  ·  11Comments

simendsjo picture simendsjo  ·  6Comments