.bash_profile别名:找不到命令

Mat*_*ose 11 macos bash alias .bash-profile

我无法让我的.bash_profile别名在我的Mac OSX终端上运行.我在〜/目录中创建了一个.bash_profile文件,然后写了两行:

echo bash profile has loaded

alias prof=“open ~/.bash_profile”
Run Code Online (Sandbox Code Playgroud)

我保存并输入终端命令:

. ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

终端显示:

bash profile has loaded

-bash: alias: /Users/kennethlarose/.bash_profile”: not found
Run Code Online (Sandbox Code Playgroud)

我一直在阅读别名配置文件,我相信我的语法是有效的.我知道配置文件是源代码,因为它显示了echo,但是无论在别名中保存什么命令,终端都会显示相同的"未找到"消息.有谁知道我还能尝试什么?

tha*_*guy 30

我们问shellcheck!

In .bash_profile line 2:
alias prof=“open ~/.bash_profile”
           ^-- SC1015: This is a unicode double quote. Delete and retype it.
Run Code Online (Sandbox Code Playgroud)

这是你的问题.OS X已将您的双引号转换为bash无法识别的花哨的倾斜引号.如果您正在编程,则可能需要禁用"智能引号".