Centos7安装fish shell,介绍及使用
第一步:yum安装fish shell
root用户下执行命令:
cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo
yum install fish
第二步:修改os默认的shell
chsh -s /usr/bin/fish
第三步:语法
Fish 的语法非常自然,一眼就能看懂。
# 设置 ls 命令的别名
alias ll='ls -lshp';
alias treeex='tree --charset ansi --dirsfirst -F';# PATH 中增加新的路径
set PATH $PATH ~/bin ~/.rvm/bin /Volumes/App/MacApp/Dev/android-sdk-macosx/tools /Volumes/App/MacApp/Dev/android-sdk-macosx/platform-tools /Volumes/App/MacApp/Dev/android-sdk-macosx/build-tools/25.0.3# 增加 Android SDK 路径设置
set ANDROID_HOME /Volumes/App/MacApp/Dev/android-sdk-macosx
set EDITOR 'subl --wait'
if
语句。
if grep fish /etc/shellsecho Found fish else if grep bash /etc/shellsecho Found bash elseecho Got nothing end
switch
语句。
switch (uname) case Linuxecho Hi Tux! case Darwinecho Hi Hexley! case FreeBSD NetBSD DragonFlyecho Hi Beastie! case '*'echo Hi, stranger! end
while
循环。
while trueecho "Loop forever" end
for
循环。
for file in *.txtcp $file $file.bak
end
第四步:函数
Fish 的函数用来封装命令,或者为现有的命令起别名。
function llls -lhG $argv end
上面代码定义了一个ll
函数。命令行执行这个函数以后,就可以用ll
命令替代ls -lhG
。其中,变量$argv
表示函数的参数。
下面是另一个例子。
function lscommand ls -hG $argv end
上面的代码重新定义ls
命令。注意,函数体内的ls
之前,要加上command
,否则会因为无限循环而报错。
第五步:配置
Fish 的配置文件是~/.config/fish/config.fish
,每次 Fish 启动,就会自动加载这个文件。
我们可以在这个文件里面写入各种自定义函数,它们会被自动加载。比如,上面的fish_prompt
函数就可以写在这个文件里面,这样每次启动 Fish,就会出现自定义的提示符。
Fish 还提供 Web 界面配置该文件。
$ fish_config
输入上面的命令以后,浏览器就会自动打开本机的 8000 端口,用户可以在网页上对 Fish 进行配置,比如选择提示符和配色主题。
Centos7安装fish shell,介绍及使用相关推荐
- Mac M1安装fish shell
第一步 安装fish shell brew安装fish: brew install fish 切换shell为fish,编辑/etc/shells,添加: /opt/homebrew/bin/fish ...
- Mac M1安装fish shell 遇见的坑
命令brew方式 brew安装fish 参考: https://blog.csdn.net/FogXcG/article/details/115364250 安装包方式 (此文是直接下载安装包安装的, ...
- shell中竖线的作用_如何在 Linux 中安装、配置和使用 Fish Shell?
每个 Linux 管理员都可能听到过 shell 这个词.你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少个 shell 可用? -- Ma ...
- linux fish颜色配置,如何在 Linux 中安装、配置和使用 Fish Shell?
(给Linux爱好者加星标,提升Linux技能) 英文:Magesh Maruthamuthu,翻译:Linux中国/MK linux.cn/article-10622-1.html 每个 Linux ...
- Linux 使用 fish shell
每个 Linux 管理员都可能听到过 shell 这个词.你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少个 shell 可用? shell ...
- Fish Shell 使用笔记
安装Fish Shell brew install fish 安装Oh My Fish curl -L https://get.oh-my.fish | fish 安装Fisher curl http ...
- fish shell的下载与安装
一 下载 可以从官方网站上下载到最近的1.23.0版本:http://www.fishshell.org/ 总共有以下这些系统版本的下载(下面的内容是官网内容的翻译): fish 已经被包含在 Deb ...
- mac fish shell的安装和使用教程
补充说明 -----–以下记录于 2018.06.27-----– 1.fish中文文档: https://wiki.archlinux.org/index.php/Fish_(%E7%AE%80%E ...
- fish shell使用及安装入门指南
fish是一个用户友好的命令行外壳程序,全称Friendly Interactive Shell. fish功能简介 语法高亮:输入命令时,你会发现输入错误的命令显示为红色,正确的命令为淡紫色,参数提 ...
最新文章
- 五分钟看完 RocketMQ应用
- XXX语录,可以不信,但不能不看
- bitcask存储引擎
- Linux Shell 常用快捷键
- 数学建模 时间序列模型
- Android最佳的开源库(四)
- python 冒泡排序算法(超级详细)
- NFS 服务学习笔记
- python写的hadoop实战_Hadoop实战
- mysql查询没有权限试图_MySQL迁移后提示查询view权限不足的处理
- php server自定义函数,php:SQL Server用户自定义的函数种类详解
- POJ1661 Help Jimmy(dp)
- tensorflow学习(一)——有关tensorflow不同层的使用(tf.nn 和tf.layers以及tf.contrib.layers)的简单区别
- 10本畅销全球的技术经典,这次整个大的
- Java操作MongoDB(聚合函数)向Mongo插入及查询数据
- [转]Spring 注解总结
- 基于单片机的十字路口交通灯设计(带左转带紧急按钮带调时间)
- 【游戏测试】游戏兼容性测试(通用方案)
- 《青山翠影》伍 现实的拷问 | 一错又错
- 修改北京定点医院amp;查询医保信息