2014-10-09 85 views
2

請收到此錯誤:爲什麼我不斷收到`慶典:本地:命令不found`

bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   local: command not found 
bash:   export: command not found 
bash:   export: command not found 
bash: ~/.bash_profile: No such file or directory 

這裏是我的.bash_profile:

當我註釋掉提示功能,錯誤消失除了最後一個!

alias ngrok=/Users/mmahalwy/Desktop/Code/ngrok 

export CLICOLOR=1 
export LSCOLORS=GxFxCxDxBxegedabagaced 

alias ls='ls -GFh' 

function prompt { 
    local BLACK="\[\033[0;30m\]" 
    local BLACKBOLD="\[\033[1;30m\]" 
    local RED="\[\033[0;31m\]" 
    local REDBOLD="\[\033[1;31m\]" 
    local GREEN="\[\033[0;32m\]" 
    local GREENBOLD="\[\033[1;32m\]" 
    local YELLOW="\[\033[0;33m\]" 
    local YELLOWBOLD="\[\033[1;33m\]" 
    local BLUE="\[\033[0;34m\]" 
    local BLUEBOLD="\[\033[1;34m\]" 
    local PURPLE="\[\033[0;35m\]" 
    local PURPLEBOLD="\[\033[1;35m\]" 
    local CYAN="\[\033[0;36m\]" 
    local CYANBOLD="\[\033[1;36m\]" 
    local WHITE="\[\033[0;37m\]" 
    local WHITEBOLD="\[\033[1;37m\]" 
    local RESETCOLOR="\[\e[00m\]" 

    export PS1="\n$RED\u [email protected] $GREEN\w $BLUE[\#] → $RESETCOLOR" 
    export PS2="| → $RESETCOLOR" 
} 

# prompt 

export PATH=/usr/local/bin:$PATH 

source ~/.git-completion.bash 
+0

你確定這是由'bash'解釋,而不是像'dash'這樣的另一個shell嗎? – 2014-10-09 23:00:24

+0

@ExplosionPills我該如何檢查? – 2014-10-09 23:06:43

+0

'本地'是一個Bash builtins。從技術上講,可以通過編寫'enable -n local'來禁用它(並通過編寫'enable local'來重新啓用),但是有人會這樣做是很奇怪的。 (和'export'類似。) – ruakh 2014-10-09 23:13:08

回答

6

如果local是真正不可用(例如,與enable -n local禁用),你會看到:

bash: local: command not found 

相反的:

bash: local: command not found 

那些多餘的空格是一條線索。仔細查看你的文件(如果你必須用十六進制編輯器),並找出那些不是空格或製表符的字節實際上是,它們是 ......並將它們更改爲真正的ASCII空格字符。

在Unicode中有幾種非破壞性空間變體;我猜他們以某種方式進入你的腳本。從網上覆制和粘貼代碼可能很危險。 :)

+0

是的!這是一個間隔問題......我簡直就是修好它,來到這裏看到你的答案。謝謝! – 2014-10-09 23:28:12

+0

+1,一流的ESP調試! – 2014-10-09 23:33:16

相關問題