私の.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_profileset -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.

おすすめ記事