I want to have a function that gets the number of lines of output from a command and adds one to it. So far I have this:
function add1
set num (tmux list-sessions | wc -l)
echo $num
end
Now how do I add 1
to $num
? (or while I'm assigning the variable)
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 create a custom prompt create a file ~/. config/fish/functions/fish_prompt. fish and fill it with your prompt. Is there a way to save multiple prompts, or add to the list of available prompts that are displayed when you run fish_config?
See the math
command in the user documentation:
set num (math $num + 1)
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