[英]-bash: : command not found when launching the shell in Mac OSX
Lately I tried to made some changes to paths in my .bash_profile.
最近,我尝试对
.bash_profile.
路径进行一些更改.bash_profile.
After I tried to validate these changes with source .bash_profile
and got -bash: : command not found
, 在尝试使用
source .bash_profile
验证这些更改并找到-bash: : command not found
,
I have also noticed that when I open the shell, before the execution of any command, it stands already "-bash: : command not found"... 我还注意到,当我打开外壳程序时,在执行任何命令之前,它的位置已经是“ -bash::命令未找到” ...
Obviously, changes made to .bash_profile weren't taken into consideration by the system niether... 显然,系统根本不考虑对.bash_profile所做的更改。
Please, help! 请帮忙! I guess that I messed with the .bash_profile too much, have no idea how to fix it...
我想我对.bash_profile太搞砸了,不知道如何解决...
Contents of .bash_profile: .bash_profile的内容:
cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH=/Users/usrname/TreeTagger/cmd:$PATH
export PATH= /Users/usrname/TreeTagger/bin:$PATH
export UIMA_HOME= $/Users/usrname/apache-uima
export PATH=$PATH:$UIMA_HOME/bin
export HEIDELTIME_HOME='/Users/usrname/Downloads/heideltime-kit/'
export TREETAGGER_HOME='/Users/usrname/TreeTagger'
source $HEIDELTIME_HOME/metadata/setenv
Updated contents of .bash_profile: .bash_profile的更新内容:
cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH="/Users/usrname/TreeTagger/cmd:$PATH"
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
export UIMA_HOME="/Users/usrname/apache-uima"
export PATH=$PATH:$UIMA_HOME/bin
export HEIDELTIME_HOME="/Users/usrname/Downloads/heideltime-kit/"
export TREETAGGER_HOME="/Users/usrname/TreeTagger"
source $HEIDELTIME_HOME/metadata/setenv
Full shell output after last quotes' correction: 最后的引号更正后的完整shell输出:
Last login: Thu Jul 31 19:07:05 on ttys000
-bash: : command not found
usr:~ usrname$ cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH="/Users/usrname/TreeTagger/cmd:$PATH"
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
export UIMA_HOME="/Users/usrname/apache-uima"
export PATH="$PATH:$UIMA_HOME/bin"
export HEIDELTIME_HOME="/Users/usrname/Downloads/heideltime-kit/"
export TREETAGGER_HOME="/Users/usrname/TreeTagger"
source $HEIDELTIME_HOME/metadata/setenv
usr:~ usrname$ source .bash_profile
-bash: : command not found
Edit with echo commands: 使用echo命令编辑:
cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH="/Users/usrname/TreeTagger/cmd:$PATH"
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
export UIMA_HOME="/Users/usrname/apache-uima"
export PATH="$PATH:$UIMA_HOME/bin"
export HEIDELTIME_HOME="/Users/usrname/Downloads/heideltime-kit/"
export TREETAGGER_HOME="/Users/usrname/TreeTagger"
echo before
source $HEIDELTIME_HOME/metadata/setenv
echo after
usr:~ usrname$ source .bash_profile
-bash: : command not found
usr:~ usrname$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
Edit +bash version: 编辑+ bash版本:
echo $BASH_VERSION
3.2.51(1)-release
usr:~ usrname$ source ./.bash_profile
-bash: : command not found
Edit +after set -x was added to .bash_profile: 将set -x添加到.bash_profile后,编辑+:
usr:~ usrname$ source ./.bash_profile
++ $'\016'
-bash: : command not found
++ update_terminal_cwd
++ local 'SEARCH= '
++ local REPLACE=%20
++ local PWD_URL=file://usr.local/Users/usrname
++ printf '\e]7;%s\a' file://usr.local/Users/usrname
This line: 这行:
export PATH= /Users/usrname/TreeTagger/bin:$PATH
is the problem. 是问题。 In a variable assignment, including an
export
, you can't have spaces around the =
. 在包括
export
在内的变量赋值中, =
周围不能有空格。 With the added space, it sets $PATH
to the empty string. 使用添加的空间,它将
$PATH
设置为空字符串。
Change it to: 更改为:
export PATH=/Users/usrname/TreeTagger/bin:$PATH
For safety, you should add double quotes: 为了安全起见,您应该添加双引号:
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
just in case there are any special characters in the value of $PATH
. 以防万一
$PATH
的值中包含任何特殊字符。
You have the same problem with UIMA_HOME
. 您对
UIMA_HOME
也有同样的问题。
UPDATE : 更新:
Based on later comments, you appear to have a stray control character in your .bash_profile
. 根据以后的评论,您的
.bash_profile
似乎有一个杂散控制字符。 With set -x
it's displayed as $'\\016'
. 使用
set -x
,将显示为$'\\016'
。 bash tries to treat that as a command name, and not surprisingly is unable to find it. bash尝试将其视为命令名称,并不奇怪地找不到它。 Edit your
.bash_profile
and delete that character. 编辑您的
.bash_profile
并删除该字符。
(The other errors needed to be corrected anyway.) (其他错误仍然需要纠正。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.