I am currently trying out the fish shell instead of using bash. One type of notation I'm having trouble learning the fish-equivalent notation for is $(command)
, similar to how it is described in this SOF post. How do I write this using fish? Keep in mind that I could use backslash characters around the command I want to evaluate, but the linked post and other posts discourage this because it is an old style of evaluating commands.
Specifically, this is the bash command I want to convert to fish syntax (for initializing rbenv during startup of the shell):
eval "$(rbenv init -)"
Fish is a fully-equipped command line shell (like bash or zsh) that is smart and user-friendly. Fish supports powerful features like syntax highlighting, autosuggestions, and tab completions that just work, with nothing to learn or configure.
It turns out, $() is called a command substitution.
fish is a smart and user-friendly command line shell for macOS, Linux, and the rest of the family. fish includes features like syntax highlighting, autosuggest-as-you-type, and fancy tab completions that just work, with no configuration required.
Fish, or the “Friendly Interactive Shell,” is the most user-friendly and interactive shell, in my opinion. It is much more customizable than Zsh and Bash. It has a ton of cool features like consistent syntax, nice tab completion and syntax highlighting, is easy to pick up and use, and has excellent runtime help.
In fish, $
is used only for variables. Correct notation equivalent to bash $(command)
is just (command)
in fish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With