我无法让我的 .bash_profile 别名在我的 Mac OSX 终端上工作。我在我的 ~/目录中创建了一个 .bash_profile 文件,然后写了两行:
echo bash profile has loaded
alias prof=“open ~/.bash_profile”
我在终端命令中保存并输入:
. ~/.bash_profile
终端显示:
bash profile has loaded
-bash: alias: /Users/kennethlarose/.bash_profile”: not found
我一直在阅读别名配置文件,我相信我的语法是有效的。我知道配置文件正在采购,因为它显示回显,但无论我在别名中保存什么命令,终端都会显示相同的“未找到”消息。有人知道我还能尝试什么吗?
最佳答案
让我们问问 shellcheck!
In .bash_profile line 2:
alias prof=“open ~/.bash_profile”
^-- SC1015: This is a unicode double quote. Delete and retype it.
这是你的问题。 OS X 已将您的双引号变成了 bash 无法识别的花哨的斜引号。如果您正在编程,您可能需要 disable "smart quotes" .
关于macos - .bash_profile 别名 : command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25319631/