[LINUX] Shell variables, environment variables

[Shell variables, environment variables]

Shell variables

-Variables that the shell has (programs that convey input from people) -Variables that are valid only for the shell that is currently in progress (child process cannot be inherited) -Valid only in the same shell (in one shell)

Environment variable

・ Variables that the computer has -Variables that are inherited by commands executed from the shell (child processes can be inherited) -Valid only within the same computer (same user)

What you can do with shell variables is to use shell variables.

Use environment variables only if you can't do with shell variables. Values defined as environment variables can also be referenced as shell variables

Variable list confirmation command set for each variable

set </ strong> Display all shell variables and environment variables ・ env </ strong> Display all environment variables ・ printenv </ strong> Display of some or all environment variables

Recommended Posts