Questions tagged [fish]

The fish shell is an alternate shell, and scripting language, for *nix systems (including macOS). Its claim to fame is being an intuitive, user friendly, and efficient modern shell. Some key examples, per their own website, are enhanced syntax highlighting, completions and autosuggestions (automatically generated from man pages), high performance, and sane scripting.

Fish is a command-line shell designed to be both smart and user-friendly, with auto-suggestions, fully 256 color support, and web-based configuration. Packages for Fish exist for macOS and various flavors of Unix.

Features that differentiate it include rich syntax coloring, auto-completion of commands and arguments, and a high-performance, multithreaded implementation.

Resources

991 questions
32
votes
10 answers

Set Default Shell in Cygwin

I've been using Cygwin for quite a while now. I now want to switch to fish from bash. Everyone is saying that you should use chsh -s /usr/bin/fish, but for some reason, chsh does not work for me. Trying to modify my Cygwin.bat file doesn't work…
Alex
  • 699
  • 1
  • 10
  • 20
32
votes
2 answers

How do I translate this `for` loop for the fish shell?

I'm translating a script from Z shell to Fish, and I've got this one part I can't figure out how to translate: for (( i=0; i < $COLUMNS; i++ )); do printf $1 done The only documentation for for loops I can find in Fish is for this kind. …
iconoclast
  • 21,213
  • 15
  • 102
  • 138
30
votes
8 answers

Get fish shell to work with gcloud command line tools?

Has anyone had any luck getting fish shell to work with google's gcloud command line tools? I'm not an expert in Fish script but these are the two files gcloud needs to run (which work fine use Fish's bash mode). Fish doesn't allow you to source…
enemykite
  • 398
  • 1
  • 3
  • 8
29
votes
1 answer

Adding comments in a fish shell function file

How do I add comments to a function a write for fish shell? Is it //. I can't seem to be able to tell. When I use //, sometimes when the function fails, it changes the user to the root directory.
aa8y
  • 3,854
  • 4
  • 37
  • 62
27
votes
3 answers

Why does Fish shell have dark blue as the default color for directories

Is it just me? I have just installed fish using brew install fish and I'm using iTerm2. The color is absolutely unreadable. How do I change it to something nicer?
Awais Hussain
  • 1,501
  • 1
  • 14
  • 15
27
votes
2 answers

How to show content of a function in fish?

In fishshell, I can create and save a function very easy, like: function aaa echo hello end funcsave aaa But how to view the body of the function aaa from command line easily? Is there any way other than: echo…
Freewind
  • 193,756
  • 157
  • 432
  • 708
26
votes
5 answers

IntelliJ's embedded terminal does not load fish functions

I'm using IntelliJ's embedded terminal with the fish shell, which works well with one exception: it does not seem to load the fish functions defined in ~/.config/fish/functions/*. When I use the macOS Terminal.app or iTerm2, the functions get loaded…
anothernode
  • 5,100
  • 13
  • 43
  • 62
26
votes
1 answer

Where are universal variables stored in the fish shell?

set -xU CFLAGS "-g" will set a universal variable that will persist across sessions. So this variable value must be store in the filesystem somewhere. Where exactly? I would like to put this file under version control (git) in my ~/dotfiles/.
RubenLaguna
  • 21,435
  • 13
  • 113
  • 151
26
votes
4 answers

In fish shell, how can I put two conditions in an if statement?

What I want to do using bash: > if true; then echo y; else echo n; fi y > if false; then echo y; else echo n; fi n > if false || true; then echo y; else echo n; fi y Now trying with fish: > if true; echo y; else; echo n; end y > if false; echo y;…
michelpm
  • 1,795
  • 2
  • 18
  • 31
25
votes
4 answers

How can I fix Edit cancelled, no changes made in shell

I run kubectl edit deployment to change the version of one of my pods (this commands opens a temp file in my text editor and then I usually edit and close this temp file) and even before I close this temp file in my text editor I can see the…
A. Karnaval
  • 727
  • 2
  • 8
  • 12
25
votes
6 answers

fish shell: Is it possible to conveniently strip extensions?

Is there any convenient way to strip an arbitrary extension from a file name, something à la bash ${i%%.*}? Do I stick to my friend sed?
Sergio Losilla
  • 730
  • 1
  • 5
  • 14
25
votes
1 answer

Fish shell: how to exit on error (bash set -e)

On bash you can use set -e inside a script in order to exit on error: set -e cd unexisting-folder echo "this line will not be printed" But on fish shell set -e is used to erase variables: set FOO bar set -e FOO echo {$FOO} # prints newline What is…
mdesantis
  • 8,257
  • 4
  • 31
  • 63
24
votes
2 answers

How to iterate for loop with limiting sequence in fish shell

I want to limit sequence in for loop. All my tries were unsecsessfull. What Am I doing wrong? I thought that this should work: for x in ((seq 100)[50..55]) echo $x end
Michael Karavaev
  • 1,439
  • 1
  • 13
  • 18
24
votes
3 answers

How can I provide tab completions to fish shell from my own script?

I am running Ubuntu 13.10 and fish 2.1.0. I want to write myself a Python script to do some tasks from the command line. The script will require command line arguments. How can I write my script such that fish can request and get possible values for…
lofidevops
  • 15,528
  • 14
  • 79
  • 119
24
votes
4 answers

How to get user confirmation in fish shell?

I'm trying to gather user input in a fish shellscript, particularly of the following oft-seen form: This command will delete some files. Proceed (y/N)? After some searching around, I am still not sure how to do this cleanly. Is these a special way…
user456584
  • 86,427
  • 15
  • 75
  • 107
1 2
3
65 66