4

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?

matt
  • 143

1 Answers1

6

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.