Im tidying up my bash exports file and categorizing variables depending what environment they are belong to.

for example the HISTIGNORE, PATH, PS1, etc.. are on the "Bash Section" and MANPAGER on the "Man Section"..

I'm just wondering how about $EDITOR and/or $VISUAL? I can't seem to find them on bash man page.


2 Answers 2


You have misclassified PATH and both EDITOR and VISUAL belong with it.

The idea that these variables belong to particular applications is wrong. They are standardized and usable by potentially any application that needs them.

  • If any application wants to search a path for executable programs, it can use PATH. (And indeed this is the case for any application that calls execvp().)
  • If any application wants to invoke a shell, it can use SHELL to find the program image file.
  • If any application wants to invoke a line editor, it can use EDITOR.
  • If any application wants to invoke a visual editor, it can use VISUAL.
  • If any application wants to invoke a pager, it can use PAGER.
  • If any application wants to know where the home directory is, it can use HOME.

And so on.

In contrast, HISTIGNORE and PS1 do not even really need to be environment variables at all; and only the latter is even mentioned (albeit without explanation) in the standard. One can set them as environment variables, in a session-leader process or in some other top-level parent, and rely upon environment inheritance to have them imported by shells.

But one can instead just set them as shell variables, in a script automatically executed by every shell (the specifics depending from the shell), and not export them into the environment. For example: I have my ~/.zshrc set PS1 and RPROMPT as shell variables, and they are not exported to be environment variables at all.

Further reading

  • Thanks! this clarrify too much of my misunderstanding.. +1 for the resources too
    – cevhyruz
    Oct 26, 2018 at 10:19

man bash mentions both the variables under edit-and-execute-command:

Invoke an editor on the current command line, and execute the result as shell commands. Bash attempts to invoke $VISUAL, $EDITOR, and emacs as the editor, in that order.

Other programs often use the variables, too.

  • bash may also switch command line editing mode depending on the values of these variables.
    – Kusalananda
    Oct 25, 2018 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .