Search code examples
macosrbenvfish

Error Message on eval $PATH in Fish


Running eval $PATH produces this message:

The file '/usr/local/var/rbenv/shims' is not executable by this user
- (line 1): begin; /usr/local/var/rbenv/shims /usr/local/bin /usr/local/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin 
                   ^
from sourcing file -
    called on line 60 of file /usr/local/Cellar/fish/HEAD/share/fish/functions/eval.fish    

in function 'eval'
    called on standard input

This doesn't seem to be causing any problems with rbenv, just curious as to what is causing this error message and if anyone knows how to fix it.

This is all on OS X El Capitan with rbenv installed by homebrew.

PS: Could this have something to do with the fact that '/usr/local/var/rbenv/shims' is a directory, not a file? If so, why does fish think it is a file?


Solution

  • eval $$PATH doesn't do what you think it does. eval runs its arguments through an an extra cycle of parsing (quote and escape processing, etc) then tries to run the result as a command. Your PATH is not going to evaluate to a valid command -- it's a list of directories where the shell looks for commands. Normally, I'd expect it to treat the entire bunch of directories as a single command and get an error because it's not a valid command name. In this case, it seems to be treating each directory in your PATH as a separate word (and hence treating the first as a command and the rest as arguments to that command). Did you set IFS to ":" by any chance?

    Anyway, the solution is simple: don't use eval $PATH. I'm not sure what you wanted it to do, but whatever that was you need to find a different way to do it.