Fish equivalent of bash $(command) notation

ecbrodie picture ecbrodie · Oct 6, 2013 · Viewed 14.8k times · Source

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 -)"

Answer

Phlogisto picture Phlogisto · Jan 4, 2014

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