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:


in my .bashrc file?


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.

  • 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 '16 at 10:23

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.