Questions tagged [fish]
Fish is a unix shell with a clean design and a limited but powerful feature set.
252
questions
0
votes
1
answer
38
views
Whitespace after backslash doesn't indicate new line on multiline variable definition (fish shell script)
before i begin i am aware this may be an issue best opened on git-hub but;
a. it's minor
b. the functionality of the backslash has already been outlined by a previously closed issue but not the white-...
0
votes
1
answer
33
views
Fish shell add args to $EDITOR using export
How can I add args to the command I use as the $EDITOR in fish shell? Specifically using the export EDITOR=... syntax rather than the set command.
I want to do something like export EDITOR='code --...
0
votes
0
answers
41
views
`$SHELL` still points to `/bin/sh` over SSH after `chsh -s $(which fish)`
I am using OpenBSD-current. After doas pkg_add fish, I ran chsh -s $(which fish) to change the default shell of my user qys to fish, and it works:
$ /usr/bin/ssh magicbane
Last login: Wed Aug 21 11:17:...
0
votes
1
answer
32
views
How to expand stdin in fish?
In kakoune (vim-like editor) I can press pipe, type a command, press enter, and it will run the command using the current selection as input, and replace that selection with the output of the command ...
0
votes
1
answer
65
views
Batch rename files by padding numeric part of filenames with leading zeros
I try to figure out how to batch rename files using Fish so that filenames like image1.png and image10.png will be replaced with image001.png and image010.png, that is, to pad numbers with leading ...
1
vote
1
answer
43
views
Fish shell: what to use instead of "function --shadow-builtin"
I tried the fish shell some years ago but abandoned it for now forgotten reasons (there was something that I couldn't do with it).
I'm looking a fish again and trying to update my old scripts to work ...
0
votes
2
answers
66
views
To batch rename files so that spaces will be replaced with underscores
Is it possible to batch rename files in Fish so that the spaces will be replaced with underscores?
I tried to figure it out myself, but haven't succeeded yet: https://fishshell.com/docs/current/cmds/...
0
votes
0
answers
35
views
Fish: To match only files or only folders
In Zsh, to match only files or only folders, I can use *(^/) and *(/) (or *(^/D) and *(/D), if I need to exclude hidden ones).
Is it possible to match only files or only folders in Fish?
0
votes
1
answer
37
views
To 'cd' by altering only the middle part of the path
In Zsh, to cd from ~/foo/bar/aaa/bbb/ccc to ~/foo/bar/zzz/bbb/ccc, I can type cd aaa zzz, and that's it. I have carefully read the Fish cd man page, but I still cannot figure out: is the same thing ...
1
vote
1
answer
54
views
Fish: To match both dot and non-dot files when wildcarding
Hidden files (where the name begins with a dot) are not considered when wildcarding unless the wildcard string has a dot in that place. E.g., ~/.* matches all hidden files and directories in your home ...
2
votes
1
answer
222
views
Joining 'fish shell' arguments into a single string with spaces
Sorry, this question is already answered for 'bash' here:
Joining bash arguments into single string with spaces.
in Fish, using "'$*'" leads to this error:
$* is not supported. In fish, ...
0
votes
1
answer
109
views
Can't install FISH on Amazon Linux 2023
I have an EC2 instance running Amazon Linux 2023. I added the fish repo per the instructions. I used dnf config-manager --add-repo... and then dnf config-manager --enable-repo.... I also added g++, ...
3
votes
2
answers
308
views
how to alias the `history` function in fish shell
I'm trying to set the fish history pager to be bat -l fish for syntax highlighting.
(i.e. set the PAGER environment variable bat -l fish just for the history command).
I tried:
# 1:
alias history &...
1
vote
0
answers
32
views
Fish script works as function, but not as standalone script [duplicate]
I have a small function that activates my desired Python venv - pya venv python_version - so something like this:
pya vm_info 3.10.12
As a fish function, this works perfectly:
function pya
set -l ...
2
votes
1
answer
58
views
Fish needs a lazy evulation to remove an element from a list
I'm running Fish version 3.7.0, and I want to write a function to remove elements from lists, based on their index.
For instance, I want to remove the element from PATH environment variable at index 2:...
1
vote
1
answer
74
views
Fish access non-aliased command from alias
How can I access the non-aliased version of a command from within the alias for that command? In bash, I can do something like alias ls='\ls -l' to access the non-aliased ls inside this alias for ls. ...
0
votes
1
answer
158
views
How to run a fish alias from cron?
I have set up a fish alias for some commands that I frequently need to run manually. Now, I want the same commands to be run regularly. How can I set up cron to automatically run a fish alias?
0
votes
2
answers
653
views
Batch convert flac to ogg with ffmpeg
I'm trying to turn this command into one that will convert a whole directory from flac to ogg:
ffmpeg -i musicfile.flac musicfile.ogg
I've read through the man page. But honestly it's a bit over my ...
0
votes
1
answer
236
views
FISH CLI What do the error numbers at the prompt mean?
I am just trying out the FISH - (the FriendlyInteractiveSHell) - CLI & whenever I type in an erroneous Command, a new Prompt appears under the faulty Command prompt with a number in square ...
2
votes
3
answers
129
views
In Fish, how do I cd to the closest parent with a .git directory?
I use Fish shell. Sometimes, I find myself in a child directory of a child directory of a child directory, several layers deep, and I want to return to the closest parent with a .git directory, as ...
0
votes
2
answers
813
views
I have to run eval $(/opt/homebrew/bin/brew shellenv) every time I start my pc for the terminal to recognise it
I use the Fish shell on OSX and installed brew.
Now I notice everytime I start my mac I need to run the eval $(/opt/homebrew/bin/brew shellenv) command again to make it recognice brew.
I also noticed ...
0
votes
1
answer
664
views
fish 'Invalid redirection target' error
This command works well in Bash and Zsh:
expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqen | sort) <({ pacman -Qqg xorg; expac -l '\n' '%E' base; } | sort -u)) | sort -n
But ...
1
vote
1
answer
71
views
Completion for gradle not applying
I'm trying to understand why the gradle completion isn't applying.
Since gw seems to be a keyword for the completion, I created an alias:
alias gw='./gradlew'
(My project uses gradle wrapper. I don'...
1
vote
2
answers
458
views
git autocompletions in Fish: how can I disable them or speed them up?
I'm running Fish shell (3.6.0) on Ubuntu. Let's say that I'm trying to run git add foo/bar.txt . I type:
git add foo
and then I press tab . Now the shell freezes up for a few seconds. Even pressing ...
1
vote
1
answer
251
views
where a variable inherit from, Fishshell
i'm trying to set an environment variable EDITOR and change it from default which is /usr/bin/nano but i can't use set -Ux due to this behavior
fish FAQ
How to find out which setting fish inherits ...
0
votes
0
answers
48
views
Fish shell can't change directory over a Webdav resource through Rclone
Fish can't cd into a folder on a Webdav remote directory through Rclone:
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
drive ) ls
Documents/ Music/ ...
0
votes
1
answer
4k
views
WARNING: Running setxkbmap against an XWayland server
I'm using Fedora 37, tilix terminal emulator with fish shell.
Whenever I open a terminal, I get the warning
WARNING: Running setxkbmap against an XWayland server
How come? How to avoid it?
3
votes
2
answers
1k
views
FISH: failed to execute process...variable exceeds the OS argument length limit
I keep getting an error when I cd to my project root directory that is on github:
> cd ~/go/src/github.com/mygithub/myapp
The below message auto pops up because I am using tide prompt which links ...
-1
votes
1
answer
512
views
Troubleshooting Oh-My-Fish configuration making fish really slow
Without changing the configuration my fish shell started to be really slow, like between 1 and 5 seconds to a simple ls command.
Note that the slow behaviour started suddenly. I have a local install ...
0
votes
0
answers
957
views
direnv and environment variables
I'm trying to get autoactivation of conda/mamba environments working using direnv but I'm running across a problem that seems to be due to my lack of understanding of how bash scripts work with ...
0
votes
1
answer
92
views
Error in fish script turns on bracketed paste mode for ssh session?
When using a small fish function I’ve cobbled together (not a developer here, so please be gentle … 😌) for accessing a number of regularly needed ssh hosts, I’m seeing a strange effect: The bracket ...
4
votes
1
answer
294
views
Fish equivalent of Bash / readline's Ctrl-O "operate-and-get-next"
Readline and therefore Bash have a very useful command called operate-and-get-next, bound by default to Ctrl-O, that executes the current line, after selecting it from the history, and advances the ...
0
votes
1
answer
137
views
Copy files with different extensions to different basename with same extensions
I have 3 files
Original.js
Original.vue
Original.css
How can I easily copy them to
Copy.js
Copy.vue
Copy.css
Until now, i always just copied one by one, but if I could use something like copy ...
0
votes
0
answers
531
views
Trying to change "non command" color in kitty terminal (ver. 0.21.2) using the fish (ver. 3.3.1) shell with the oh-my-fish theme slacker
I've been trying to change the color of non-command such as the picture below (the uncompleated 'help')
link to the theme im using in omf: https://github.com/maqboolkhan/omf-theme-slacker
my kitty....
1
vote
1
answer
127
views
Unable to run git commands before shutdown
I would like to use systemd to accomplish this if possible. This is what I have done so far.
Wrote a script in fish that will stage, commit and push files to a repository. Script made executable with ...
1
vote
1
answer
208
views
Where is the default fish completion style defined or how do I style the fish completion options listing?
I'm using complete -c cl -o editz -f -xa '(cl -autocomplete 15 | sed "s/:/\\t/" | sed -r "s/^(.{60}).*/\1/")' to dynamically feed the latest 15 entires in a log program to fish for ...
2
votes
2
answers
3k
views
How to run a command n times in the fish shell?
The fish documentation gives the following way to run a for loop.
for i in 1 2 3 4 5;
echo $i
end
Let us say I want to run a command 1000 times, How can I do it?
0
votes
1
answer
225
views
My fish prompt gets messed up when I add more set_color
I've been trying to make a custom fish prompt, but there's one problem that I can't seem to figure out how to fix.
I got this to work, but it's not exactly what I want, as I want the ash@cat-box to be ...
0
votes
1
answer
97
views
'fish_config browse' opens balena etcher instead of the default web browser
When I type fish_config browse in fish to configure it, it opens Balena etcher and not the web browser.
I am on Pop!_OS 22.04 lts and migrated from bash.
0
votes
1
answer
81
views
Complete a positional argument only once
I'm trying to write a completion for a command (call it gs) that takes an SSH hostname as its first argument, and an arbitrary string as the second argument.
I've stolen this from the default SSH ...
1
vote
1
answer
193
views
Fish completion that depends on other flags
I have a command, that can connect to remote machines and so the completion should be based on which machine the user provided. That means that if the user pass -D DEVICE_ID I want the completion to ...
0
votes
1
answer
1k
views
Fish shell - what's wrong with this syntax?
I have a bash script which cats a heredoc string, and I'm running it inside a fish shell and then piping it to a source call, like so:
~/foo/baz:
1 #!/usr/bin/env bash
2
3 cat << EOS
4 ...
1
vote
1
answer
644
views
Fish shell - syntax for creating a switch statement which checks against an array of values
I'm studying the RBENV codebase, and I see that on line 116 of the rbenv-init file, a function is created which contains a switch statement. My hypothesis is that we check whether the value of the ...
4
votes
0
answers
407
views
Command line history in the fish shell suffering from short term memory issues
Over the last few months, I've been trying out the fish shell as my interactive shell. One issue that somewhat irritates me is that the shell occasionally forgets recent commands from its command ...
0
votes
2
answers
8k
views
Fish shell: How to disable help message?
When I start fish, it prints:
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
And then the prompt.
I've actually used fish for a while so I don't need ...
1
vote
2
answers
182
views
Exit 'history' in fish
I recently switched from bash to fish. I like it, but I don't know how to exit, when I enter history. How do I do that?
-1
votes
2
answers
330
views
Use Git Version of mv/rm etc When in Repository
Git has its own versions of commands such as mv and rm that we really ought to use when doing these operations inside repositories.
However, I'm sure I'm not the only person who often forgets to do ...
3
votes
1
answer
282
views
Fish Completions - How to prevent file completions?
I am trying to write some completions for an in-house tool. We'll call it thetool.
Lots of the commands to thetool do not take a 'file' as an argument. I thought that --no-files and/or --exclusive ...
3
votes
1
answer
989
views
When pressing tab, how can I make fish complete to directory/ instead of directory/prefix?
I'm using fish shell. Let's say that I have a directory named books, containing files title-1, title-2 and title-3:
$ tree books
books/
├── title-1
├── title-2
└── title-3
0 directories, 3 files
If ...
2
votes
2
answers
205
views
Fish shell reports "math: Error: Missing operator" on tab completion
I noticed the error this morning, but I don't think I have changed anything last night, so I am very confused right now. Perhaps I updated some utilities on my system and it somehow broke the back ...