为什么我的终端别名失败
Why is my terminal alias failing
我正在读这个:
http://www.maclife.com/article/columns/terminal_101_creating_aliases_commands
我在 bash 个人资料中写道:
别名工作区 = 'cd Documents/workspace'
但是我得到以下信息:
-bash: alias: workspace: not found
-bash: alias: =: not found
-bash: alias: cd Documents/workspace: not found
当我获取文件时。怎么回事?
我在 SO 上搜索并发现:.bash_profile aliases: command not found 但我没有使用双引号
请考虑删除 = 号周围的空格。
供参考:http://www.gnu.org/software/bash/manual/bashref.html#Bash-Builtins
这不在 mac,但仍然 bash:
$ cat with-spaces.sh
alias workspace = 'cd Documents/workspace'
$ . with-spaces.sh
./with-spaces.sh: line 1: alias: workspace: not found
./with-spaces.sh: line 1: alias: =: not found
./with-spaces.sh: line 1: alias: cd Documents/workspace: not found
$ # checking result...
$ alias workspace
bash: alias: workspace: not found
$ cat without-spaces.sh
alias workspace='cd Documents/workspace'
$ . without-spaces.sh
$ # checking result...
$ alias workspace
alias workspace='cd Documents/workspace'
我正在读这个: http://www.maclife.com/article/columns/terminal_101_creating_aliases_commands
我在 bash 个人资料中写道: 别名工作区 = 'cd Documents/workspace'
但是我得到以下信息:
-bash: alias: workspace: not found
-bash: alias: =: not found
-bash: alias: cd Documents/workspace: not found
当我获取文件时。怎么回事?
我在 SO 上搜索并发现:.bash_profile aliases: command not found 但我没有使用双引号
请考虑删除 = 号周围的空格。
供参考:http://www.gnu.org/software/bash/manual/bashref.html#Bash-Builtins
这不在 mac,但仍然 bash:
$ cat with-spaces.sh
alias workspace = 'cd Documents/workspace'
$ . with-spaces.sh
./with-spaces.sh: line 1: alias: workspace: not found
./with-spaces.sh: line 1: alias: =: not found
./with-spaces.sh: line 1: alias: cd Documents/workspace: not found
$ # checking result...
$ alias workspace
bash: alias: workspace: not found
$ cat without-spaces.sh
alias workspace='cd Documents/workspace'
$ . without-spaces.sh
$ # checking result...
$ alias workspace
alias workspace='cd Documents/workspace'