aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc_src/and.txt15
-rw-r--r--doc_src/count.txt5
-rw-r--r--doc_src/doc.hdr10
-rw-r--r--doc_src/end.txt3
-rw-r--r--doc_src/exit.txt2
-rw-r--r--doc_src/or.txt10
-rw-r--r--doc_src/return.txt5
-rw-r--r--doc_src/set.txt37
-rw-r--r--doc_src/type.txt3
9 files changed, 64 insertions, 26 deletions
diff --git a/doc_src/and.txt b/doc_src/and.txt
index 4d45ea9c..bd884b1b 100644
--- a/doc_src/and.txt
+++ b/doc_src/and.txt
@@ -2,16 +2,23 @@
\section and and - Conditionally execute a command
\subsection and-synopsis Synopsis
- <tt>COMMAND1; and COMMAND2</tt>
+<tt>COMMAND1; and COMMAND2</tt>
\subsection and-description Description
-The \c and builtin is used to execute a command if the current exit status (as set by the last previous command) is zero
+The \c and builtin is used to execute a command if the current exit
+status (as set by the last previous command) is zero
+
+The and command does not change the current exit status.
\subsection and-example Example
-The following code runs the \c make command to build a program, and if it succeeds, it runs <tt>make install</tt>, which installs the program.
+The following code runs the \c make command to build a program, if the
+build succceds, the program is installed. If either step fails,
+<tt>make clean</tt> is run, which removes the files created by the
+build process
+
<pre>
-make; and make install
+make; and make install; or make clean
</pre>
diff --git a/doc_src/count.txt b/doc_src/count.txt
index 06720274..db9c5e37 100644
--- a/doc_src/count.txt
+++ b/doc_src/count.txt
@@ -6,7 +6,7 @@
\subsection count-description Description
-<tt>count</tt> returns the number of arguments that were passed to
+<tt>count</tt> prints the number of arguments that were passed to
it. This is usually used to find out how many elements an environment
variable array contains, but this is not the only potential usage for
the count command.
@@ -18,6 +18,9 @@ count program, and if the user uses a help option, this help page is
displayed, but if a help option is contained inside of a variable or
is the result of expansion, it will be passed on to the count program.
+Count exits with a non-zero exit status if no arguments where passed
+to it, with zero otherwise.
+
\subsection count-example Example
<pre>
diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr
index aed5145b..17ff4e3e 100644
--- a/doc_src/doc.hdr
+++ b/doc_src/doc.hdr
@@ -620,8 +620,8 @@ Variables can be explicitly set to be universal with the \c -U or \c
local with the \c -l or \c --local switch. The scoping rules when
creating or updating a variable are:
--# If a variable is explicitly set to either universal, global or local, that setting will be honored
--# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed
+-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
+-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed.
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing functions. If no function is executing, the variable will be global.
There may be many variables with the same name, but different scopes.
@@ -697,9 +697,9 @@ Variables can be explicitly set to be exported with the \c -x or \c
switch. The exporting rules when creating or updating a variable are
identical to the scoping rules for variables:
--# If a variable is explicitly set to either be exported or not exported, that setting will be honored
--# If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept
--# If a variable is not explicitly set to be either global or local and has never before been defined, the variable will not be exported
+-# If a variable is explicitly set to either be exported or not exported, that setting will be honored.
+-# If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept.
+-# If a variable is not explicitly set to be either global or local and has never before been defined, the variable will not be exported.
\subsection variables-arrays Arrays
diff --git a/doc_src/end.txt b/doc_src/end.txt
index 0385982b..b98aef82 100644
--- a/doc_src/end.txt
+++ b/doc_src/end.txt
@@ -5,9 +5,12 @@
if CONDITION; COMMAND_TRUE [else; COMMAND_FALSE] end
while CONDITION; COMMANDS; end
switch VALUE; [case [WILDCARD...]; [COMMANDS...];...] end
+begin; [COMMANDS...] end
</pre>
\subsection end-description Description
<tt>end</tt> ends a block of commands. For more information, read the
documentation for the block constructs, such as \c if, \c for and \
while.
+
+The end command does not change the current exit status.
diff --git a/doc_src/exit.txt b/doc_src/exit.txt
index 1cb61015..b71f7b0d 100644
--- a/doc_src/exit.txt
+++ b/doc_src/exit.txt
@@ -11,4 +11,4 @@ code. Otherwise the exit code will be 0.
If exit is called while sourcing a file (using the <a
href="#source">.</a> builtin) the rest of the file will be skipped,
-but the shell will not exit.
+but the shell itself will not exit.
diff --git a/doc_src/or.txt b/doc_src/or.txt
index d84e8286..8ac3c3a2 100644
--- a/doc_src/or.txt
+++ b/doc_src/or.txt
@@ -8,10 +8,16 @@
The \c or builtin is used to execute a command if the current exit status (as set by the last previous command) is non-zero
+The or command does not change the current exit status.
+
\subsection or-example Example
-The following code runs the \c make command to build a program, or if it fails, it runs <tt>make clean</tt>, which removes the files created by the build process
+The following code runs the \c make command to build a program, if the
+build succceds, the program is installed. If either step fails,
+<tt>make clean</tt> is run, which removes the files created by the
+build process
+
<pre>
-make; or make clean
+make; and make install; or make clean
</pre>
diff --git a/doc_src/return.txt b/doc_src/return.txt
index 997d60a3..005ca360 100644
--- a/doc_src/return.txt
+++ b/doc_src/return.txt
@@ -8,12 +8,13 @@
used to halt a currently running function. It is usually added inside
of a conditional block such as an <a href="#if">if</a> statement or a
<a href="#switch">switch</a> statement to conditionally stop the
-executing function and return to the caller.
+executing function and return to the caller, but it can also be used
+to specify the exit status of a function.
- \c STATUS is the return status of the function. If unspecified, the status is set to 0.
\subsection return-example Example
-The following code is an implementation of the false program as a fish builtin
+The following code is an implementation of the false command as a fish function
<p>
<pre>function false
return 1
diff --git a/doc_src/set.txt b/doc_src/set.txt
index d41b514e..bc03c1e1 100644
--- a/doc_src/set.txt
+++ b/doc_src/set.txt
@@ -1,22 +1,22 @@
\section set set - Handle environment variables.
\subsection set-synopsis Synopsis
-<code>set [OPTIONS] [VARIABLE_NAME [VALUES...]]</code>
-
-or
-
-<code>set [OPTIONS] [VARIABLE_NAME[INDICES]... [VALUES...]]</code>
+<pre>set [OPTIONS] [VARIABLE_NAME [VALUES...]]
+set [OPTIONS] [VARIABLE_NAME[INDICES]... [VALUES...]]
+set -q VARIABLE_NAMES...
+set (-e | --erase) VARIABLE_NAME[INDICES]...
+set (-e | --erase) VARIABLE_NAME</pre>
The <code>set</code> builtin causes fish to assign the variable <code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
\subsection set-description Description
- <code>-e</code> or <code>--erase</code> causes the specified environment variable to be erased
-- <code>-g</code> or <code>--global</code> causes the specified environment variable to be made global. If this option is not supplied, the specified variable will disappear when the current block ends
-- <code>-l</code> or <code>--local</code> forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
+- <code>-l</code> or <code>--local</code> forces the specified environment variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
+- <code>-g</code> or <code>--global</code> causes the specified environment variable to be given a global scope. Non-global variables disappear when the block they belong to ends
+- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <code>-n</code> or <code>--names</code> List only the names of all defined variables
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
-- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
If set is called with no arguments, the names and values of all
@@ -24,9 +24,6 @@ environment variables are printed. If some of the scope or export
flags have been given, only the variables matching the specified scope
are printed.
-If the \c -e or \c --erase option is specified, the variable
-specified by the following arguments will be erased
-
If a variable is set to more than one value, the variable will be an
array with the specified elements. If a variable is set to zero
elements, it will become an array with zero elements.
@@ -37,11 +34,29 @@ changed. When array indices are specified to set, multiple arguments
may be used to specify additional indexes, e.g. <code>set PATH[1]
PATH[4] /bin /sbin</code>.
+-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
+-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the previos variable scope is used.
+-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing functions. If no function is executing, the variable will be global.
+
+-# If a variable is explicitly set to either be exported or not exported, that setting will be honored.
+-# If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept.
+-# If a variable is not explicitly set to be either global or local and has never before been defined, the variable will not be exported.
+
+If the \c -e or \c --erase option is specified, the variable specified
+by the following arguments will be erased. If variable indices are
+specified, only the thecified slices of the array veraible will be
+erased.
+
The set command requires all switch arguments to come before any
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.
+Set exits with an exit status of zero it the variable assignemnts
+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.
+
\subsection set-example Example
<code>set -xg</code> will print all global, exported variables.
diff --git a/doc_src/type.txt b/doc_src/type.txt
index 2a20f562..26afca76 100644
--- a/doc_src/type.txt
+++ b/doc_src/type.txt
@@ -15,6 +15,9 @@ With no options, indicate how each name would be interpreted if used as a comman
- \c -p or \c --path either return the name of the disk file that would be executed if name were specified as a command name, or nothing if 'type -t name' would not return 'file'
- \c -P or \c --force-path either return the name of the disk file that would be executed if name were specified as a command name, or nothing no file with the specified name could be found in the PATH
+\c type returns a zero exit status if the specified command was found,
+otherwise the exit status is one.
+
\subsection type-example Example
<tt>type fg</tt> outputs the string 'fg is a shell builtin'.