aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-01-31 15:57:08 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-01-31 15:57:08 -0800
commitad8d68dd4390753901b5e1dae4b4c4b44be7fcea (patch)
tree5b8f5e3ca3d698dd7ae764f2833ab7b91726fd93 /doc_src
parent0db1b6ce44b2dcae94a4d33c04b606ef819bb78b (diff)
Make subcommands modify $status, and make builtin_set not modify status unless it fails
Diffstat (limited to 'doc_src')
-rw-r--r--doc_src/fish_prompt.txt3
-rw-r--r--doc_src/index.hdr.in5
-rw-r--r--doc_src/set.txt21
3 files changed, 17 insertions, 12 deletions
diff --git a/doc_src/fish_prompt.txt b/doc_src/fish_prompt.txt
index 41fd1ea4..2ddc8e55 100644
--- a/doc_src/fish_prompt.txt
+++ b/doc_src/fish_prompt.txt
@@ -11,8 +11,7 @@ By defining the \c fish_prompt function, the user can choose a custom
prompt. The \c fish_prompt function is executed when the prompt is to
be shown, and the output is used as a prompt.
-Please keep in mind that the function is executed by <a
-href='index.html#expand-command-substitution'>command substitution</a>, and so the exit status of commands within fish_prompt will not modify the <a href="index.html#variables-status">$status</a> seen outside of fish_prompt.
+The exit status of commands within \c fish_prompt will not modify the <a href="index.html#variables-status">$status</a> seen outside of fish_prompt.
\subsection fish_prompt-example Example
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 946bb73d..fac56197 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -578,9 +578,8 @@ this list is executed, and substituted by the output. If the output is
more than one line long, each line will be expanded to a new
parameter.
-A command substitution will not change the value of the <a
-href='#variables-status'>status</a> variable outside of the command
-substitution.
+The exit status of the last run command substitution is available in the <a
+href='#variables-status'>status</a> variable.
Only part of the output can be used, see <a href='#expand-index-range'>index
range expansion</a> for details.
diff --git a/doc_src/set.txt b/doc_src/set.txt
index e2155fb7..e46cd9c4 100644
--- a/doc_src/set.txt
+++ b/doc_src/set.txt
@@ -68,13 +68,14 @@ non-switch arguments. For example, <code>set flags -l</code> will have
the effect of setting the value of the variable <code>flags</code> to
'-l', not making the variable local.
-In assignment mode, set exits with an exit status of zero it the
-variable assignments where sucessfully performed, with a non-zero exit
-status otherwise. In query mode, the exit status is the number of
-variables that where not found. In erase mode, set exits with a zero
-exit status in case of success, with a non-zero exit status if the
-commandline was invalid, if the variable was write-protected or if the
-variable did not exist.
+In assignment mode, set exits with a non-zero exit status if variable
+assignments could not be successfully performed. If the variable assignments
+were performed, the exit status is unchanged. This allows simultaneous capture
+of the output and exit status of a subcommand, e.g. <code>if set output
+(command)</code>. In query mode, the exit status is the number of variables that
+were not found. In erase mode, set exits with a zero exit status in case of
+success, with a non-zero exit status if the commandline was invalid, if the
+variable was write-protected or if the variable did not exist.
\subsection set-example Example
@@ -85,3 +86,9 @@ variable did not exist.
<code>set -e smurf</code> removes the variable \c smurf.
<code>set PATH[4] ~/bin</code> changes the fourth element of the \c PATH array to \c ~/bin
+
+<pre>if set python_path (which python)
+ echo "Python is at $python_path"
+end</pre>
+
+The above outputs the path to Python if \c which returns true.