下面我展示了我的文件的结构,每个文件的一些代码,以及我为尝试获取所有源代码并做好准备所做的工作。
结构
~/
.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
能够输入任何命令。