当我在我的mac终端上打开一个新标签时,它会显示不必要的代码。
此代码在终端上从终端加载的文件中吐出,如.profile,.bash_profile,.bash
以下是我打开新标签时显示的代码。
Last login: Mon Jan 16 15:00:48 on ttys002
-bash: export: `-s': not a valid identifier
-bash: export: `/Users/jayparteek/.rvm/scripts/rvm': not a valid identifier
-bash: export: `]]': not a valid identifier
-bash: /usr/local/bin[[: No such file or directory
-bash: /usr/local/bin: is a directory
我知道这来自以下任一文件。
的.bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
export EDITOR='mate -w'
alias mysql="/usr/local/mysql/bin/mysql"
alias mysqld="sudo /Library/StartupItems/MySQLCOM/MySQLCOM"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
/usr/local/bin[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
.profile
export BUNDLER_EDITOR=mate
alias gco='git co'
alias gci='git ci'
alias grb='git rb'
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
改进了.bash_profile文件
source $HOME/.rvm/scripts/rvm
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
export EDITOR='mate -w'
alias mysql="/usr/local/mysql/bin/mysql"
alias mysqld="sudo /Library/StartupItems/MySQLCOM/MySQLCOM"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
/usr/local/bin[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
答案 0 :(得分:1)
它来自您的bash个人资料中[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
的所有重复实例。
尝试将其替换为更为简单的source $HOME/.rvm/scripts/rvm
你绝对不应该多次这样做,一次就足够了。如果它不起作用,那么您可能希望查看类似问题的其他答案,以了解它们是如何解决的。当我加载它时,This question在这个问题的边栏中。
希望有所帮助。