direnv export bash is using some bash-only syntax; specifically, ANSI C strings:
$'...' 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.