2

When attempting to evaluate a .envrc file I get the error "emulate: command not found" or "cd: -q: invalid option" or any number of various possible errors in my completely valid zsh/fish/elivsh/tcsh script.

OmnipotentEntity
  • 16,531
  • 6
  • 62
  • 96
  • This problem drove me up a wall for several hours before I finally bothered the author on IRC. He told me that many other people had the same issue. So I figured I'd try to help with discoverability by posting a self-answer. – OmnipotentEntity Mar 05 '21 at 19:26
  • `attempting to use the following .envrc file` - did you forget to paste the file ? – martin-g Mar 08 '21 at 08:23
  • Not quite. I decided that making a block quote that just had `source myscript.zsh` wasn't terribly enlightening and too specific to a particular shell, so I restructured the question, but I missed editing that specific phrase. Good catch. – OmnipotentEntity Mar 08 '21 at 19:06

1 Answers1

5

direnv uses only bash to evaluate your .envrc file. It then exports the changes back to your original shell. You'll have to rewrite your .envrc in bash.

Also check out direnv stdlib for the utility functions that direnv gives you access to from within any .envrc file.

OmnipotentEntity
  • 16,531
  • 6
  • 62
  • 96