Do you need export for Bash internal variables?
For bash internal variables you do not need export. From your example HISTTIMEFORMAT is used by bash itself and does not need an export MYSQL_HISTFILE is for mysql and that needs export otherwise mysql does not see it. Thanks for contributing an answer to Unix & Linux Stack Exchange!
What happens to the export property in Bash?
The -n option causes the export property to be removed from each name. If a variable name is followed by =word, the value of the variable is set to word. export returns an exit status of 0 unless an invalid option is encountered, one of the names is not a valid shell variable name, or -f is supplied with a name that is not a function.
Where do I set my environment variables in Bash?
HISTFILE — a file where the shell will write the command history. In addition to variables that are used by the shell, most shell scripts use variables for their internal purposes. Most environment variables (e.g. PATH) make sense for a whole session, and should be set in ~/.profile or a similar file.
How are shell variables used in the shell?
Shell variables are a feature of the shell as a programming language. Shell variables are used only inside the shell where they are set; they have no meaning to programs launched by the shell. Shell variables are duplicated when a subshell is created, like the rest of the shell state.
What does the exportfile in / etc / exports do?
The /etc/exportsfile controls which file systems are exported to remote hosts and specifies options. Blank lines are ignored, comments can be made by starting a line with the hash mark (#), and long lines can be wrapped with a backslash (\\).
What’s the difference between echoes and exports in Bash?
That’s a little script that basically does the same, it just echoes $ {MYVAR}, but the difference is that it will run in a different process because it’s a separate script. It depends where a variable is going to be used, whether you have to export it or not.