In bash I can say:
$ echo "a$(echo b)c" abc
How do I do this in the fish shell?
Unlike other shells, fish has no dedicated VARIABLE=VALUE syntax for setting variables. Instead it has an ordinary command: set , which takes a variable name, and then its value.
To be able to run fish scripts from your terminal, you have to do two things. Add the following shebang line to the top of your script file: #!/usr/bin/env fish . Mark the file as executable using the following command: chmod +x <YOUR_FISH_SCRIPT_FILENAME> .
Prompt Tab The "prompt" tab displays the contents of the current fish shell prompt. It allows selection from 17 predefined prompts. To change the prompt, select one and press "Prompt Set!". DANGER: This overwrites ~/.
echo a(echo b)c
If you have quotes, you must exit them:
echo "a"(echo b)"c"
If your subcommand may have newlines, as of fish 2.3, you have to save and restore $IFS:
set -l IFS echo "a"(cat ~/file.txt)"c" set -e IFS
Eventually string
will be able to handle this case.
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