0

In eshell when I do

$ echo "$(pwd)credentials.json"
Directory /Users/gmauer/../credentials.json

I get that Directory prefix. I'm assuming that it is because eshell reimplements pwd to return some sort of object, and Directory .... is how that is being coerced into a string.

So how do I interpolate this correctly so that I can use export it to an environment variable?

1

Simply use the environment variable PWD, e.g.,

~/.emacs.d $ export CREDIT="$PWD/credentials.json"
~/.emacs.d $ echo $CREDIT
/Users/xcy/.emacs.d/credentials.json

When you type pwd in Eshell

~/.emacs.d $ pwd

Eshell tries to execute one of the following (the order matters)

  1. The lisp function eshell/pwd
  2. The executable file pwd in your PATH
  3. The lisp function pwd

When you use (pwd) in your Eshell

$ echo "$(pwd)credentials.json"
Directory /Users/gmauer/../credentials.json

the lisp function pwd will be used, and the function pwd is for showing current working directory in the Echo Area. You should use eshell/pwd instead

~/.emacs.d $ echo "$(eshell/pwd)/credentials.json"
/Users/xcy/.emacs.d/credentials.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.