터미널이 열릴 때 ~/.profile이 실행되지 않습니까?

터미널이 열릴 때 ~/.profile이 실행되지 않습니까?

어떻게 든 내 bash 프롬프트가 "elementary:~ steven$"으로 변경되었으며 이를 기본 프롬프트로 다시 변경하고 싶습니다. 먼저 ~/.bashrc에 다음을 추가한 다음 ~/.profile에 추가했습니다.

export PS1="\s-\v\$ "

터미널을 열 때 둘 다 실행되지 않습니다. 두 파일 중 하나에서 명령을 실행하면 source해당 세션의 나머지 부분에서는 제대로 작동합니다.

여기서 제가 간과하고 있는 것이 있나요?

편집: Ian이 제안한 결과는 다음과 같습니다.

elementary:~ steven$ bash --login --verbose
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
fi
/usr/libexec/path_helper -s
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/local/AVRMacPack/bin"; export PATH;

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
fi
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
if [ -e "/usr/local/AVRMacPack" ]; then
PATH="$PATH:/usr/local/AVRMacPack/bin"
export PATH
fi

# Setting PATH for Python 3.2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"
export PATH
elementary:~ steven$ which bash
which bash
/bin/bash

답변1

.bashrcbash 매뉴얼 페이지에 따르면 비대화형 쉘에 대해서만 실행됩니다.

.bash_profile로그인 쉘에 대해 실행됩니다.

파일은 .profileKorn 쉘에 의해 로드됩니다. 나는 bash가 이것에 전혀 관심을 기울이는 것을 모릅니다. bash 매뉴얼 페이지에서 이에 대한 참조를 찾을 수 없습니다.

OS X에서 Terminal.app 프로그램은 새로운 Terminal.app 창을 열 때마다 로그인 셸을 실행합니다.

따라서 프롬프트 설정을 .bash_profile.

에서는 언제든지 다음을 수행할 수 있습니다 .bash_profile. 드문 일은 아니지만 어떤 영향을 미칠 수 있는지는 말할 수 없습니다.

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

그러면 두 개의 파일을 유지 관리할 필요가 없습니다.

답변2

내 말이 틀렸을 수도 있지만 bash가 쉘인 경우 .bashrc가 아닌 ~/.bash_profile에 배치해야 합니다.

답변3

당신이 당신의 일을 망친 경우배쉬 제어어떤 이유로든 터미널을 로드하고 싶나요?.프로필매 세션마다 다시 작성하세요.~/.bash_profile이렇게:

if [ -f ~/.profile ]; then
   source ~/.profile
fi

...새 세션을 시작하여 모든 것이 정상으로 돌아왔는지 확인합니다.

관련 정보