Fish-ing for tips


I am trying to get used to fish as a default shell. I like some things in it, but can not quite get used to other things, so I wonder - maybe I am cooking it wrong? So here are things that I could not find a solution for, while switching from bash.

  • bash$ DISPLAY=:1 gedit - very simple thing, how do I set and environment variable for just one command execution in the most simple possible way.

  • bash$ scp hostname:somedir/*.jpg . - when I try to run this in fish, for some reason I get "fish: Warning: No match for wildcard 'hostname:somedir/*.jpg'. The command will not be executed." and I could not figure out how to actually run the command in a quick Googling.

  • I have (almost) come to terms that 'while' and 'for' syntax is different, but I still wonder - maybe there is some bash compatibility mode that I missed that would allow me to use my old ways?

I do like the colors, the shortened cwd in the prompt, the univeral history and univeral variables, lower memory usage and funkier completions. Any other fish features people like? Especially I am interested in features that are not enabled by default.

Currently unrated


Aigars Mahinovs: Fish-ing for tips | Linux-Support 5 years, 3 months ago

[...] source: Go to Source Feed source: License: The original licenses are retained – [...]

Link | Reply

Benjamin Sigonneau 5 years, 3 months ago

Regarding environment variables, I guess the easiest answer to your problem would be:

begin; set -l DISPLAY :1; gedit; end

which is more verbose than the sh way. So that you might want to write an helper function.

Link | Reply

Douglas 5 years, 3 months ago

ad scp: I guess fish behaves like tcsh, that is: If you use any wildcard (?, *) it will try to find a file that matches (and as you don't have a file with that name in the current dir, it complains. You HAVE to escape or quote if you want to pass the wildcard to (in that case) scp, so
scp hostname:somedir/\*.jpg .
should work.

(bash is clever enough to figure out what you want to do)

I haven't used fish, but I would recommend that you check the manpage for bash; it might be able to do what you want if configured correctly (e.g. is "the shortened cwd in the prompt" maybe what bash gives you if you set

Link | Reply

James McCoy 5 years, 3 months ago

Fish was probably what got me in the habit of not using "ENVVAR=foo command". You can just as easily do that by using the env command, "env ENVVAR=foo command", and it's shell agnostic.

Link | Reply

Dmitrijs Ledkovs 5 years, 3 months ago

I miss bash-completion for things that don't have fish completion, I wish there was a way to'whitelist' bash-completions for some things, when fish doesn't offer it.

Link | Reply

New Comment


required (not published)


Recent Posts






RSS / Atom