profile bashrc 실행 순서

Jmnote (토론 | 기여)님의 2012년 3월 30일 (금) 17:22 판 (→‎분석)

  • profile bashrc bash_profile 실행 순서

1 기본 설정

기본 설정에서 실행 순서는 다음과 같다. (특별히 코드를 변경하지 않았다면 이 순서대로 실행될 것이다.)

  1. /etc/profile.d/test.sh
  2. /etc/profile
  3. /etc/bashrc
  4. ~/.bashrc
  5. ~/.bash_profile

2 분석

로컬 설정인 ~/.bash_profile에 다음과 같은 내용이 있다.

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

→ ~/.bashrc 가 있으면 그것을 실행시킨다.

로컬 설정인 ~/.bashrc 에 다음과 같은 내용이 있다.

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

→ /etc/bashrc가 있으면 그것을 실행시킨다.

정리하면

  • /etc/bashrc → ~/.bashrc → ~/.bash_profile

3 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}