diff --git a/doc_src/and.txt b/doc_src/and.txt index 4d45ea9ce..bd884b1b6 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 - COMMAND1; and COMMAND2 +COMMAND1; and COMMAND2 \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 make install, 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, +make clean is run, which removes the files created by the +build process +
-make; and make install +make; and make install; or make cleandiff --git a/doc_src/count.txt b/doc_src/count.txt index 06720274b..db9c5e37c 100644 --- a/doc_src/count.txt +++ b/doc_src/count.txt @@ -6,7 +6,7 @@ \subsection count-description Description -count returns the number of arguments that were passed to +count 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
diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index aed5145b1..17ff4e3e1 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 0385982b5..b98aef822 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\subsection end-description Description end 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 1cb610152..b71f7b0db 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 . 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 d84e82864..8ac3c3a28 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 make clean, 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, +make clean is run, which removes the files created by the +build process +
-make; or make clean +make; and make install; or make cleandiff --git a/doc_src/return.txt b/doc_src/return.txt index 997d60a3d..005ca3608 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 if statement or a switch 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
function false return 1 diff --git a/doc_src/set.txt b/doc_src/set.txt index d41b514e4..bc03c1e13 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 -set [OPTIONS] [VARIABLE_NAME [VALUES...]]
- -or - -set [OPTIONS] [VARIABLE_NAME[INDICES]... [VALUES...]]
+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_NAMETheset
builtin causes fish to assign the variableVARIABLE_NAME
the valuesVALUES...
. \subsection set-description Description --e
or--erase
causes the specified environment variable to be erased ---g
or--global
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 ---l
or--local
forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local +--l
or--local
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 +--g
or--global
causes the specified environment variable to be given a global scope. Non-global variables disappear when the block they belong to ends +--U
or--universal
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. --n
or--names
List only the names of all defined variables --q
or--query
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. --u
or--unexport
causes the specified environment not to be exported to child processes ---U
or--universal
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. --x
or--export
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.set PATH[1] PATH[4] /bin /sbin
. +-# 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,set flags -l
will have the effect of setting the value of the variableflags
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 Exampleset -xg
will print all global, exported variables. diff --git a/doc_src/type.txt b/doc_src/type.txt index 2a20f562d..26afca76a 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 type fg outputs the string 'fg is a shell builtin'.