尽管在路径中,但无法从 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 编译器在我的路径中该怎么办?

答案1

看来您在编辑PATH变量时犯了一个错误。输出中的反斜杠字符PATH被视为文字,而不是转义空格。

你需要:

PATH="/Applications/Racket v6.2/bin:$PATH"; export PATH

或者:

PATH=/Applications/Racket\ v6.2/bin:$PATH; export PATH

相关内容