Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to load serveral variables from a file (not .bash_*) which has similar to:

export MY_VAR='foo'

The command I was using to "source" this was

`tail -1 myFile`

This works, but it I echo $MY_VAR, I get


But it I actually run export MY_VAR='foo' in the terminal, then echo $MY_VAR it outputs:


Why the descrepancy in the quotes and how do I fix this?

share|improve this question
Is there a reason to not use source myFile command to "source" the file? – ssssteffff Apr 26 '14 at 9:11
It is the apache envvars file, I add a few envvars for my site, and need only those to be sourced when I log in over ssh. I am totally open to other strategies. – Jacob Valenta Apr 26 '14 at 9:15
up vote 3 down vote accepted

Using backticks is something that is referred to as command substitution. The shell substitutes it after parsing tokens in the output. Since it encountered quotes in the output, it'd escape those. As such, it'd execute:

export MY_VAR=\'foo\'

leaving the variable surrounded with quotes.

You could instead make use of process substitution and continue to use the source command:

source <(tail -1 myFile)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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