From 0d309b0d9e4da03a608e33076649f7a80c763e32 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 25 Nov 2021 21:52:03 +0100 Subject: [PATCH] docs/for-bash-users: Some cosmetic changes --- doc_src/fish_for_bash_users.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc_src/fish_for_bash_users.rst b/doc_src/fish_for_bash_users.rst index deba3a86d..aff97ddfd 100644 --- a/doc_src/fish_for_bash_users.rst +++ b/doc_src/fish_for_bash_users.rst @@ -23,12 +23,14 @@ will correctly handle all possible filenames. Variables --------- -Fish sets and erases variables with :ref:`set ` instead of ``VAR=VAL`` and ``declare`` and ``unset`` and ``export``. ``set`` takes options to determine the scope and exportedness of a variable:: +Fish sets and erases variables with :ref:`set ` instead of ``VAR=VAL`` and a variety of separate builtins like ``declare`` and ``unset`` and ``export``. ``set`` takes options to determine the scope and exportedness of a variable:: - # Define $PAGER global and exported, so this is like ``export PAGER=less`` + # Define $PAGER global and exported, + # so this is like ``export PAGER=less`` set -gx PAGER less - # Define $alocalvariable only locally - like ``local alocalvariable=foo`` + # Define $alocalvariable only locally, + # like ``local alocalvariable=foo`` set -l alocalvariable foo or to erase variables:: @@ -48,14 +50,16 @@ For instance, here's bash .. code-block:: sh > foo="bar baz" - > printf '"%s"\n' $foo # will print two lines, because we didn't double-quote, so the variable is split + > printf '"%s"\n' $foo + # will print two lines, because we didn't double-quote, so the variable is split "bar" "baz" And here is fish:: > set foo "bar baz" - > printf '"%s"\n' $foo # foo was set as one element, so it will be passed as one element, so this is one line + > printf '"%s"\n' $foo + # foo was set as one element, so it will be passed as one element, so this is one line "bar baz" All variables are "arrays" (we use the term "lists"), and expanding a variable expands to all its elements, with each element as its own argument (like bash's ``"${var[@]}"``::