Environment variable

PGD·2022년 8월 10일
0

An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

They were introduced in their modern form in 1979 with Version 7 Unix, so are included in all Unix operating system flavors and variants from that point onward including Linux and macOS. From PC DOS 2.0 in 1982, all succeeding Microsoft operating systems, including Microsoft Windows, and OS/2 also have included them as a feature, although with somewhat different syntax, usage and standard variable names.

  • https://en.wikipedia.org/wiki/Environment_variable

  • ~/.bashrc file
    사용자가 새 셸을 열 때마다 실행되는 셸 스크립트
    새 셸을 열 때마다 실행되기 때문에 이 파일에다 환경변수를 등록하는 명령어를 입력해 놓으면 셸을 열 때마다 일일이 수동으로 환경변수를 등록할 필요가 없게 된다.

vim ~/.bashrc

export {name}={value}

ex)
JAVA_HOME='/usr/local/jvm/java-17-openjdk-amd64'
export JAVA_HOME
export PATH=/opt/apache-maven-3.8.6/bin:$PATH

profile
student

0개의 댓글