Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fish equivalent of bash $(command) notation

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 -)" 
like image 490
ecbrodie Avatar asked Oct 06 '13 17:10

ecbrodie


People also ask

Does fish support bash commands?

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.

What is $() called in bash?

It turns out, $() is called a command substitution.

What is fish command?

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.

How is fish different from bash?

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.


1 Answers

In fish, $ is used only for variables. Correct notation equivalent to bash $(command) is just (command) in fish.

like image 180
Phlogisto Avatar answered Sep 28 '22 20:09

Phlogisto