【发布时间】:2014-12-16 19:25:40
【问题描述】:
我在 Mac 上编辑了我的 .profile 文件,以便在终端中创建别名。我已添加:
alias goto_test="cd /Library/WebServer/Documents"
我保存 .profile 文件并运行:
source .profile
但是,终端返回错误:
-bash: alias: /Library/WebServer/Documents: not found
我做错了什么?
.
备注
当我在终端中执行cd /Library/WebServer/Documents 时,路径工作正常。
我注意到用alias show_test="ls" 定义别名会引发错误,因为它似乎试图用引号执行“ls”。
alias show_test=ls 不带引号也可以。
但是,使用不带引号的alias goto_test=cd ~/ 是行不通的,因为它是一个多字命令。
【问题讨论】:
标签: bash terminal alias .profile