source ~/.bashrc 或 ~/.profile 或 ~/.bash_profile 停止終端

source ~/.bashrc 或 ~/.profile 或 ~/.bash_profile 停止終端

下面我展示了我的文件的結構、每個文件中的一些程式碼,以及我為嘗試獲取所有文件並準備好執行的操作而所做的事情。

結構

~/
  .bash_profile
  .bashrc
  .profile

.bashrc

#-------------------------------------------------------------
# Source global definitions (if any)
#-------------------------------------------------------------
if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

if [ -f /etc/bashrc ]; then
    . /etc/bashrc   # --> Read /etc/bashrc, if present.
fi

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

.bash_設定檔

#
# # Setting PATH for Python 3.5
# # The orginal version is saved in .bash_profile.pysave
PATH="/bin:/usr/bin:/usr/local/bin" # Make sure to use double quotes not single quotes And on a new line 
export PATH

. /etc/profile
. ~/.git-completion.bash

if [ -f ~/bin/.bashrc ]; then
    . ~/bin/.bashrc   # --> Read ~/bashrc, if present.
fi

if [ -f /etc/bashrc ]; then
    . /etc/bashrc   # --> Read /etc/bashrc, if present.
fi

# ENVIRONMENT VARIABLES

# add my ~/bin dir to path
PATH=${PATH}:~/bin
export PATH

# simple prompt
# default macOS prompt is: \h:\W \u\$
export PS1="\W \$ "

# enable Terminal color
export CLICOLOR=1

# Pretty colors
Default=$'\e[0m'
Italic=$'\e[3m'
Black=$'\e[30m'
Red=$'\e[31m'
Green=$'\e[32m'
Yellow=$'\e[33m'
Blue=$'\e[34m'
LightBlue=$'\e[36m'
Magenta=$'\e[35m'
Cyan=$'\e[36m'
White=$'\e[37m'
NewLine=$'\n'

#
# # Setting PATH for Python 3.5
# # The orginal version is saved in .bash_profile.pysave
PATH="/bin:/usr/bin:/usr/local/bin" # Make sure to use double quotes not single quotes And on a new line 
export PATH

# ENVIRONMENT VARIABLES

# add my ~/bin dir to path
PATH=${PATH}:~/bin
export PATH

# source files
source /etc/profile
source ~/.git-completion.bash
source ~/bin/.bash_profile
if [ -f ~/.bash_profile ]; then
  . ~/.bash_profile
fi
if [ -f ~/bin/.bashrc ]; then
    . ~/bin/.bashrc   # --> Read ~/bashrc, if present.
fi

if [ -f /etc/bashrc ]; then
    . /etc/bashrc   # --> Read /etc/bashrc, if present.
fi

# simple prompt
# default macOS prompt is: \h:\W \u\$
export PS1="\W \$ "

# enable Terminal color
export CLICOLOR=1

# Pretty colors
Default=$'\e[0m'
Italic=$'\e[3m'
Black=$'\e[30m'
Red=$'\e[31m'
Green=$'\e[32m'
Yellow=$'\e[33m'
Blue=$'\e[34m'
LightBlue=$'\e[36m'
Magenta=$'\e[35m'
Cyan=$'\e[36m'
White=$'\e[37m'
NewLine=$'\n'

當我進入 Terminal.app 或 iTerm.app 並嘗試source使用~/.bashrc~/.bash_profile或運行時~/.profile,它會停止運行,然後最終崩潰。我對所有這些設置不是很熟悉,但我確實知道我需要它來停止成為一個混蛋,因此任何有關我做錯了什麼或我的設置可能有問題的信息將不勝感激。如果您知道如何解決這個問題,那就太棒了。

編輯:

追蹤評論:

$ </proc/$$/cmdline tr '\0' '\n'
bash: /proc/93005/cmdline: No such file or directory

$ bash -i    <-[this stalls]

$ bash -li   <-[this stalls as well]

我不在乎我是否必須手動獲取它。我不想手動獲取它,但我不知道還能做什麼。我認為這只是最後的努力,試圖讓所有這些東西適合我。

另外,當我打開 iTerm 時,bash 啟動得併不好。我必須opt+C能夠輸入任何命令。

相關內容