Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

As I understand it, exporting an environment variable makes it available to any processes spawned from the current one. But the only processes that will be interested in the HISTIGNORE variable (and some related variables) are other instances of bash, which will read ~/.bashrc and pick up the value anyway. So should I use:

export HISTIGNORE="&"

or just:

HISTIGNORE="&"

in my .bashrc file?

share|improve this question
up vote 6 down vote accepted

For shell settings, you don't need export, for the reason you give. And it's better not to use it, in case some other application reacts to the same variable but doesn't interpret the value in the same way. I don't know any other application that uses HISTIGNORE, but the issue arises with other variables. For example, PS1 should definitely not be exported since different shells use this variable but with different escape sequences.

share|improve this answer
    
Readers of this question/answer, might also find this answer to be useful for the general case of when to use export in Bash start-up files. – Anthony Geoghegan Jan 14 at 10:23

Your Answer

 
discard

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.