Bash
儘管在路徑中,但無法從 Bash 訪問二進製文件
我正在學習如何在 Racket 中程式。它的二進製文件在
"/Applications/Racket v6.2/bin/racket"
.讓我展示會發生什麼:
MacBook:~ enedil$ echo $PATH /Applications/Racket\ v6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin MacBook:~ enedil$ ls -l /Applications/Racket\ v6.2/bin/racket -rwxr-xr-x@ 1 enedil admin 53712 Jun 19 22:23 /Applications/Racket v6.2/bin/racket MacBook:~ enedil$ file /Applications/Racket\ v6.2/bin/racket /Applications/Racket v6.2/bin/racket: Mach-O 64-bit executable x86_64 MacBook:~ enedil$ racket -bash: racket: command not found MacBook:~ enedil$ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14) Copyright (C) 2007 Free Software Foundation, Inc.
這怎麼可能?如果我想要一個完整的 Racket 編譯器在我的路徑中怎麼辦?
PATH
編輯變數時,您似乎犯了一個錯誤。輸出中的反斜杠字元PATH
被認為是文字,而不是轉義空格。你需要:
PATH="/Applications/Racket v6.2/bin:$PATH"; export PATH
或者:
PATH=/Applications/Racket\ v6.2/bin:$PATH; export PATH