macos - .bash_profile 别名 : command not found

标签 macos alias bash

我无法让我的 .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/

相关文章:

macos - 有没有办法确定我的 macOS 机器上 docker 卷的大小?

android - Room 中的 Sum 和 Count - 别名没有这样的列

macos - Time Machine API/命令行脚本?

java - mac-osx 10.9.4 Hadoop 2.7.1线程 “main” java.lang.UnsupportedClassVersionError中的异常:不支持的major.minor版本51.0

elasticsearch - ElasticSearch RollOver索引-为什么别名不能指向多个索引?

linux - 优化基于MAC地址匹配提取子串的bash脚本

php - 从 php 运行 bash 脚本

bash - 用于递归比较目录的 Shell 脚本

objective-c - cocoa:如何获取工具栏的Tag

javascript - 如何在 create-react-app 中创建导入快捷方式/别名?