📜 ⬆️ ⬇️

Overview Friendly interactive shell (fish) and why it is better than bash

Recently, the admin of the company in which I work, advised to try to replace the standard bash with zsh or fish . I started looking for information on both shells before trying them.

It should explain why I do not like bash. The main inconvenience for me is the bash script. When you need something simple to implement, the syntax is pretty clear. But as soon as you need to make some complicated logic (at least a few commands in a row), it becomes very difficult to understand the code, especially when you watch someone else's script. The next thing that upset me is the difficulties in autocomplexing and searching for commands. Of course, the combination Ctrl + r saved, but I wanted this search to be the default. Well, there remained a purely individual dissatisfaction with the setting of colors in the bash. The only thing I managed to set up was a hint, and it would have been very difficult for me to do that without the online PS1 generator.

Dissatisfaction with all these shortcomings has slowly matured in me over the past 2 years (approximately as much as I actively use the command line). I decided to look for alternatives. Having opened "Habr" (the main source of useful information for me), I began to study articles on both shells. The first thing that caught my eye was just one short article about fish . Whereas about zsh there was quite enough information. After examining superficially the last shell, I realized that it is even more difficult to assimilate than bash. Of course, anything can be learned and used in full, but I'm not a sysadmin, but a Python web developer and I need a handy tool that would not distract from the main work, be easily and understandably tuned, and of course it was pleasant to the eye.
')
image

If you are interested in the shell fish , please under the cat.

The only Russian-language manual for fish I found here .

Short list of benefits




These are only the main advantages of fish .

I would also like to write about the differences between these two shells


Installation


Ubuntu like distros:

sudo apt-get install fish 

Before this, you can add ppa for version 2.1.1 (in turnips version 2.0.0):

 sudo apt-add-repository ppa:fish-shell/release-2 sudo apt-get update 

I also use Arch, so I'll give the command for it as well:

 sudo pacman -S fish 


Differences in tips


I was pleasantly surprised by the display of tips in fish . From the screenshot above you can see that in addition to displaying the time, the tooltip displays the full path to the current directory, only shortened to the first letters. This is extremely convenient, do not constantly call pwd. Also, a very nice feature is that fish can be configured in such a way that if there is a .git folder in the current directory, the tip shows the active branch (committee in the screenshot). Best of all, you can customize the hint just by selecting in the fish_config tab of the prompt, Classic + git and all. I just added to this function the display of time and color to your liking.

useful links


Of site
Arch wiki - very detailed about setting fish
Rus mans
config.fish
fish_prompt.fish

Please send errors to the PM, I will try to fix it promptly.

If you have questions - ask in the comments. I am happy to answer.

Source: https://habr.com/ru/post/248881/


All Articles