direnv export bash the generated variable gets a dollar sign at the beginning for no reason?

direnv export bash is using some bash-only syntax; specifically, ANSI C strings:


In bash, $'...' honors escapes inside ... — so \t can be used to refer to a tab, for example. In sh, it’s not a recognized syntax feature at all.

Thus you need to run bash yourscript, not sh yourscript — or, better, start the script with a #!/usr/bin/env bash shebang, and run it with /path/to/yourscript (or just yourscript if it’s installed at a location in the PATH), letting the shebang be used to select an interpreter.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top