mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
docs: Expand math for bash users a bit
Also fix some awkward typos.
This commit is contained in:
parent
3abe21708d
commit
a4adda5da8
2 changed files with 12 additions and 4 deletions
|
@ -73,6 +73,8 @@ See :ref:`Shell variables <variables>` for more.
|
|||
|
||||
.. [#] zsh also does not perform word splitting by default (the SH_WORD_SPLIT option controls this)
|
||||
|
||||
.. _bash-globs:
|
||||
|
||||
Wildcards (globs)
|
||||
-----------------
|
||||
|
||||
|
@ -221,16 +223,22 @@ Fish does not have ``$((i+1))`` arithmetic expansion, computation is handled by
|
|||
|
||||
math $i + 1
|
||||
|
||||
It can handle floating point numbers::
|
||||
Unlike bash's arithmetic, it can handle floating point numbers::
|
||||
|
||||
> math 5 / 2
|
||||
2.5
|
||||
|
||||
And also hase some functions, like for trigonometry::
|
||||
And also has some functions, like for trigonometry::
|
||||
|
||||
> math cos 2 x pi
|
||||
1
|
||||
|
||||
You can pass arguments to ``math`` separately like above or in quotes. Because fish uses ``()`` parentheses for :ref:`command substitutions <bash-command-substitutions>`, quoting is needed if you want to use them in your expression::
|
||||
|
||||
> math '(5 + 2) * 4'
|
||||
|
||||
Both ``*`` and ``x`` are valid ways to spell multiplication, but ``*`` needs to be quoted because it looks like a :ref:`glob <bash-globs>`.
|
||||
|
||||
Prompts
|
||||
-------
|
||||
|
||||
|
|
|
@ -564,8 +564,8 @@ That means quoting isn't the absolute necessity it is in other shells. Most of t
|
|||
|
||||
.. [#] Unlike bash or zsh, which will join with the first character of $IFS (which usually is space).
|
||||
|
||||
Derefencing variables
|
||||
'''''''''''''''''''''
|
||||
Dereferencing variables
|
||||
'''''''''''''''''''''''
|
||||
|
||||
The ``$`` symbol can also be used multiple times, as a kind of "dereference" operator (the ``*`` in C or C++), like in the following code::
|
||||
|
||||
|
|
Loading…
Reference in a new issue