From fc5eb0a98a498b885832e7c076cef133d231349d Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 15 May 2024 22:44:07 +0200 Subject: [PATCH] fish_for_bash_users: Put explanation on subshells first and *then* explain things that aren't subshells. --- doc_src/fish_for_bash_users.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc_src/fish_for_bash_users.rst b/doc_src/fish_for_bash_users.rst index fcf3f2cba..edb5c35a4 100644 --- a/doc_src/fish_for_bash_users.rst +++ b/doc_src/fish_for_bash_users.rst @@ -417,6 +417,8 @@ This includes things like: baz & done +Fish does not currently have subshells. You will have to find a different solution. The isolation can usually be achieved by just scoping variables (with ``set -l``), but if you really do need to run your code in a new shell environment you can use ``fish -c 'your code here'`` to do so explicitly. + ``()`` subshells are often confused with ``{}`` grouping, which does *not* use a subshell. When you just need to group, you can use ``begin; end`` in fish:: (foo; bar) | baz @@ -437,8 +439,6 @@ The pipe will simply be run in the same process, so ``while read`` loops can set Subshells are also frequently confused with :ref:`command substitutions `, which bash writes as ```command``` or ``$(command)`` and fish writes as ``$(command)`` or ``(command)``. Bash also *uses* subshells to implement them. -The isolation can usually be achieved by just scoping variables (with ``set -l``), but if you really do need to run your code in a new shell environment you can always use ``fish -c 'your code here'`` to do so explicitly. - Builtins and other commands ---------------------------