在 fish shell 配置文件中定义别名时出错
Getting an error when defining an alias in the fish shell config file
我的 config-fish 文件中有这个别名:
alias em='emacsclient -n -c $PWD&'
但是我在启动新终端时看到这个错误:
- (line 1): Variables may not be used as commands. In fish, please define a function or use 'eval $argv'.
emacsclient -n -c $PWD& $argv;
^
in function 'em'
called on standard input
遇到这种情况怎么办?
首先要注意的是 fish alias
命令与 bash alias
命令不是一回事。在鱼中 alias something
只是 shorthand 对于
function something
something $argv
end
在这种情况下,我建议将其缩写为:abbr em 'emacsclient -n -c $PWD&'
。或者使用 function
语法明确定义它。
我的 config-fish 文件中有这个别名:
alias em='emacsclient -n -c $PWD&'
但是我在启动新终端时看到这个错误:
- (line 1): Variables may not be used as commands. In fish, please define a function or use 'eval $argv'.
emacsclient -n -c $PWD& $argv;
^
in function 'em'
called on standard input
遇到这种情况怎么办?
首先要注意的是 fish alias
命令与 bash alias
命令不是一回事。在鱼中 alias something
只是 shorthand 对于
function something
something $argv
end
在这种情况下,我建议将其缩写为:abbr em 'emacsclient -n -c $PWD&'
。或者使用 function
语法明确定义它。