내 .bash_profile이 실패하기 시작했습니다.

내 .bash_profile이 실패하기 시작했습니다.

주요 편집: 더 자세히 조사한 결과 이제 문제는 .bash_profile이 아니라 각 명령 후에 실행되는 항목에 있다고 생각됩니다. 모든 명령 후에 나는 신비한 흔적을 얻습니다. 심지어 새로운 줄도 있습니다. 나는 이것을 "것"이라고 불러야할지 모르겠습니다. 누구든지 말해 주시면 감사하겠습니다. 그리고 이 질문을 취소하고 새 질문을 게시해야 합니까?

원래는 stackoverflow에 게시했지만 누군가 여기에 게시해야 한다고 제안하여 여기에 게시합니다.

저는 macOS 10.12.1을 사용하고 있습니다.

나는 터미널과 bash를 거의 사용하지 않지만 약 6주 전에 뭔가가 극적으로 바뀌었습니다. 아래는 몇 년 동안 변경되지 않은 내 .bash_profile이고, 아래는 터미널 창을 열 때 나타나는 이상한 내용입니다. 문제는 내 .bash_profile에 있는 것 같지만 다른 곳에 있을 수도 있습니다.

나는 이것을 알아낼 수 없습니다. 어떤 도움이라도 대단히 감사하겠습니다.

.bash_profile:

set -x
echo "Running ~/.bash_profile"

red=$(tput setaf 1)
none=$(tput sgr0)
PS1='\[$red\]***\t \! \w>\[$none\]'   # Using \W will provide just basename
#echo PS1=$PS1 
PS4=' $LINENO: '  # Set bash script prompt to line number of script
export PS4
alias cc="/usr/bin/llvm-gcc-4.2"
DEV_INC=/Developer/SDKs/MacOSX10.5.sdk/usr/include
#temp="/Developer/Tools:/Developer/Applications:"${PATH}:~/bin::
temp="/Developer/Tools:/Developer/Applications:"${PATH}:/Application s/MacVim.app/Contents/MacOS:~/bin::
PATH=$temp
#echo PATH=$PATH
#include_path=.:/usr/include/:
#echo include_path=$include_path
echo BASH_VERSION=$BASH_VERSION

. ~/MYFUNCTIONS
export -f mygetopts isoption
compgen -A function  # List all functions

새 bash 창을 연 흔적:

Last login: Wed Nov 30 18:07:37 on ttys003
+ echo 'Running ~/.bash_profile'
Running ~/.bash_profile
++ tput setaf 1
cd ~/work
+ red=''
++ tput sgr0
+ none=''
+ PS1='\[$red\]***\t \! \w    \[$none\]'
+ PS4=' $LINENO: '
 10: export PS4
 11: alias cc=/usr/bin/llvm-gcc-4.2
 12: DEV_INC=/Developer/SDKs/MacOSX10.5.sdk/usr/include
 14: temp=/Developer/Tools:/Developer/Applications:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/MacVim.app/Contents/MacOS:/Users/XXXXX/bin::
 15: PATH=/Developer/Tools:/Developer/Applications:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/MacVim.app/Contents/MacOS:/Users/XXXXX/bin::
 19: echo 'BASH_VERSION=3.2.57(1)-release'
BASH_VERSION=3.2.57(1)-release
 21: . /Users/XXXXX/MYFUNCTIONS
 22: export -f mygetopts isoption
 23: compgen -A function
isoption
mygetopts
shell_session_delete_expired
shell_session_history_allowed
shell_session_history_check
shell_session_history_enable
shell_session_save
shell_session_save_history
shell_session_update
update_terminal_cwd
  0: shell_session_history_check
  1: '[' 0 -eq 0 ']'
  2: SHELL_SESSION_DID_HISTORY_CHECK=1
  3: shell_session_history_allowed
  2: '[' -n /Users/XXXXX/.bash_history ']'
  5: local allowed=0
  6: shopt -q histappend
  6: '[' -n '' ']'
  9: allowed=1
  11: '[' 1 -eq 1 ']'
  12: return 0
  47: shell_session_history_enable
  1: umask 077
  1: touch /Users/XXXXX/.bash_sessions/AC4138F0-CE17-4189-80E4-29F987640EBB.historynew
  2: HISTFILE=/Users/XXXXX/.bash_sessions/AC4138F0-CE17-4189-80E4-29F987640EBB.historynew
  3: SHELL_SESSION_HISTORY=1
  28: '[' 'shell_session_history_check; update_terminal_cwd' = shell_session_history_check ']'
  30: [[ shell_session_history_check; update_terminal_cwd =~ (.*)(; *shell_session_history_check *| *  shell_session_history_check *; *)(.*) ]]
  31: PROMPT_COMMAND=update_terminal_cwd
  0: update_terminal_cwd
  5: local url_path=
  9: local i ch hexch LC_CTYPE=C LC_ALL=
  10: (( i = 0 ))
  19: (( i < 16 ))
  11: ch=/
  12: [[ / =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=/
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=U
  12: [[ U =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=U
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=s
  12: [[ s =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=s
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=e
  12: [[ e =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=e
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=r
  12: [[ r =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=r
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=s
  12: [[ s =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=s
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=/
  12: [[ / =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=/
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=j
  12: [[ j =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=j
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=i
  12: [[ i =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=i
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=m
  12: [[ m =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=m
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=s
  12: [[ s =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=s
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=l
  12: [[ l =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=l
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=a
  12: [[ a =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=a
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=g
  12: [[ g =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=g
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=e
  12: [[ e =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=e
  19: (( ++i ))
  19: (( i < 16 ))
  11: ch=r
  12: [[ r =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=r
  19: (( ++i ))
  19: (( i < 16 ))
  23: printf '\e]7;%s\a' file://groksiMac-804.local/Users/XXXXX
***18:34:36 500 ~    cd ~/work
 1: cd /Users/XXXXX/work
  1: update_terminal_cwd
  5: local url_path=
  9: local i ch hexch LC_CTYPE=C LC_ALL=
  10: (( i = 0 ))
  19: (( i < 21 ))
  11: ch=/
  12: [[ / =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=/
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=U
  12: [[ U =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=U
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=s
  12: [[ s =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=s
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=e
  12: [[ e =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=e
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=r
  12: [[ r =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=r
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=s
  12: [[ s =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=s
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=/
  12: [[ / =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=/
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=j
  12: [[ j =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=j
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=i
  12: [[ i =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=i
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=m
  12: [[ m =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=m
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=s
  12: [[ s =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=s
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=l
  12: [[ l =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=l
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=a
  12: [[ a =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=a
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=g
  12: [[ g =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=g
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=e
  12: [[ e =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=e
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=r
  12: [[ r =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=r
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=/
  12: [[ / =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=/
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=w
  12: [[ w =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=w
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=o
  12: [[ o =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=o
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=r
  12: [[ r =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=r
  19: (( ++i ))
  19: (( i < 21 ))
  11: ch=k
  12: [[ k =~ [/._~A-Za-z0-9-] ]]
  13: url_path+=k
  19: (( ++i ))
  19: (( i < 21 ))
  23: printf '\e]7;%s\a' file://groksiMac-804.local/Users/XXXXX/work
***18:34:36 501 ~/work

답변1

set -x당신의 상단에서 제거합니다 ~/.bash_profile. set -xbash가 실행하기 전에 실행하는 모든 명령을 출력하도록 합니다. Bash 매뉴얼 페이지에서:

          -x      After expanding each simple command, for command, case command, select
                  command, or arithmetic for command, display the expanded value of PS4,
                  followed  by the command and its expanded arguments or associated word
                  list.

답변2

더 자세히 조사한 결과 PS1 변수에 문제가 있는 것으로 확인되었습니다. 저는 PS1='[$red]***\t를 사용하고 있습니다! \w>[$none]'은 수년 동안 사용되었지만 더 이상 작동하지 않으며 명령줄에 입력된 모든 bash 명령에 대해 긴 추적을 생성합니다. 주석을 달면 추적이 중지됩니다.

관련 정보