linux - 在fish shell中定义别名

标签 linux shell fish

我想在fish中定义一些别名。显然应该可以在

中定义它们
~/.config/fish/functions

但是当我重新启动 shell 时它们不会自动加载。有什么想法吗?

最佳答案

只需使用别名。这是一个基本示例:

# Define alias in shell
alias rmi "rm -i"

# Define alias in config file ( `~/.config/fish/config.fish` )
alias rmi="rm -i"

# This is equivalent to entering the following function:
function rmi
    rm -i $argv
end

# Then, to save it across terminal sessions:
funcsave rmi

最后一条命令创建文件~/.config/fish/functions/rmi.fish

有兴趣的人可以在the official manual 中了解更多关于 fish 别名的信息。 .

关于linux - 在fish shell中定义别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2762994/

相关文章:

RubyRep 安装程序导致错误 "Exception caught: Mysql::Error: query: not connected: SHOW TABLES"

c - (-1 >= sizeof(buffer)) 怎么可能是真的?程序无法获得正确的比较结果

java - 如何从 Java 应用程序执行命令?

macos - 如何将 Brew 添加到路径、Ventura 上的 Fish

fish shell 显示管道错误 - 新错误

python 崩溃了;如何解码 dmesg 日志中的段错误?

python - 在 Python 解释器 : Explain behavior 中运行 Python 解释器

bash - shell脚本随机数生成

linux - 为什么 "/usr/bin/env bash -x"只能在命令行中工作?

shell - 最常用的 fish shell 命令?