1

I've got drush in /usr/local/bin. Running which drush returns /usr/local/bin/drush. However running drush displays "-bash: /usr/bin/drush: No such file or directory". Running /usr/local/bin/drush works correctly.

My $PATH is /usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

[added in an edit] Before I had this issue I removed a copy of the script that was at /usr/bin/drush. It wasn't built correctly.

What on earth could be causing this problem? I do not want to have to type out /usr/local/bin/drush every time; that's why /usr/local/bin is in my $PATH.

meustrus
  • 6,637
  • 5
  • 42
  • 53

1 Answers1

3

Have you run drush before in this shell, then moved it from /usr/bin to /usr/local/bin ? If so, the hash command will show that the shell has remembered the command in the /usr/bin location and will presume it's there without re-checking. Run hash -r will clear this list.

Worked example:

$ echo >/usr/bin/hello 'echo hello'
$ chmod +x /usr/bin/hello
$ hash
hits    command
   1    /bin/chmod
$ hello
hello
$ hash
hits    command
   1    /bin/chmod
   1    /usr/bin/hello
$ which hello
/usr/bin/hello
$ mv /usr/bin/hello /usr/local/bin/
$ hello
bash: /usr/bin/hello: No such file or directory
$ hash
hits    command
   1    /usr/bin/which
   1    /bin/chmod
   1    /bin/mv
   2    /usr/bin/hello
$ which hello
/usr/local/bin/hello
$ hash -r
$ hash
hash: hash table empty
$ hello
hello
$ hash
hits    command
   1    /usr/local/bin/hello
Stuart Caie
  • 2,803
  • 14
  • 15