Frage

In letzter Zeit habe ich versucht, einige Änderungen an den Pfaden in meinem vorzunehmen .bash_profile.
Nachdem ich versucht habe, diese Änderungen mit zu validieren source .bash_profile und bekam -bash: : command not found,
Mir ist auch aufgefallen, dass beim Öffnen der Shell vor der Ausführung eines Befehls bereits „-bash:“ steht.:Befehl nicht gefunden"...
Offensichtlich wurden an .bash_profile vorgenommene Änderungen vom System nicht berücksichtigt ...
Bitte helfen Sie!Ich vermute, dass ich zu viel mit .bash_profile herumgespielt habe und keine Ahnung habe, wie ich das beheben kann ...

Inhalt von .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

Aktualisierter Inhalt von .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

Vollständige Shell-Ausgabe nach der Korrektur der letzten Anführungszeichen:

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

Bearbeiten mit Echo-Befehlen:

  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

+Bash-Version bearbeiten:

echo $BASH_VERSION
3.2.51(1)-release
usr:~ usrname$ source ./.bash_profile
-bash: : command not found

Bearbeiten Sie +, nachdem set -x zu .bash_profile hinzugefügt wurde:

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
War es hilfreich?

Lösung

Diese Linie:

export PATH= /Users/usrname/TreeTagger/bin:$PATH

ist das Problem.In einer Variablenzuweisung, einschließlich einer export, Sie können keine Leerzeichen um das herum haben =.Mit dem zusätzlichen Platz wird es fest $PATH zur leeren Zeichenfolge.

Ändern Sie es in:

export PATH=/Users/usrname/TreeTagger/bin:$PATH

Zur Sicherheit sollten Sie doppelte Anführungszeichen hinzufügen:

export PATH="/Users/usrname/TreeTagger/bin:$PATH"

Nur für den Fall, dass der Wert von Sonderzeichen enthält $PATH.

Du hast das gleiche Problem mit UIMA_HOME.

AKTUALISIEREN :

Basierend auf späteren Kommentaren scheinen Sie einen verirrten Kontrollcharakter in sich zu haben .bash_profile.Mit set -x es wird angezeigt als $'\016'.Bash versucht, dies als Befehlsnamen zu behandeln, kann ihn aber nicht überraschend nicht finden.Bearbeiten Sie Ihre .bash_profile und lösche dieses Zeichen.

(Die anderen Fehler mussten ohnehin korrigiert werden.)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top