mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
Change terminology in docs from 'environment variables' -> 'shell variables'
This commit is contained in:
parent
55bc4168bf
commit
07944cfd20
|
@ -9,7 +9,7 @@
|
|||
\subsection eval-example Example
|
||||
|
||||
The following code will call the ls command. Note that \c fish does not
|
||||
support the use of environment variables as direct commands; \c eval can
|
||||
support the use of shell variables as direct commands; \c eval can
|
||||
be used to work around this.
|
||||
|
||||
<pre>
|
||||
|
|
|
@ -413,7 +413,7 @@ command line.
|
|||
These are the general purpose tab completions that \c fish provides:
|
||||
|
||||
- Completion of commands (builtins, functions and regular programs).
|
||||
- Completion of environment variable names.
|
||||
- Completion of shell variable names.
|
||||
- Completion of usernames for tilde expansion.
|
||||
- Completion of filenames, even on strings with wildcards such as '*', '**' and '?'.
|
||||
- Completion of job ID, job name and process names for <a href="#expand-process">process expansion</a>.
|
||||
|
@ -559,7 +559,7 @@ undergoes the process of parameter expansion before it is sent on to
|
|||
the command. Parameter expansion is a powerful mechanism that
|
||||
allows you to expand the parameter in various ways, including
|
||||
performing wildcard matching on files, inserting the value of
|
||||
environment variables into the parameter or even using the output of
|
||||
a shell variable into the parameter or even using the output of
|
||||
another command as a parameter list.
|
||||
|
||||
\subsection expand-wildcard Wildcards
|
||||
|
@ -634,10 +634,10 @@ The command <code>mv *.{c,h} src/</code> moves all files with the suffix
|
|||
|
||||
\subsection expand-variable Variable expansion
|
||||
|
||||
A dollar sign followed by a string of characters is expanded into the
|
||||
value of the environment variable with the same name. For an
|
||||
introduction to the concept of environment variables, read the <a
|
||||
href="#variables">Environment variables</a> section.
|
||||
A dollar sign followed by a string of characters is expanded into the
|
||||
value of the shell variable with the same name. For an
|
||||
introduction to the concept of shell variables, read the
|
||||
<a href="#variables">Shell variables</a> section.
|
||||
|
||||
Undefined and empty variables expand to nothing.
|
||||
|
||||
|
@ -699,7 +699,7 @@ instead be expressed as <code>$$foo[1][5]</code>.
|
|||
|
||||
\subsection expand-index-range Index range expansion
|
||||
|
||||
Both command substitution and environment variables support accessing only
|
||||
Both command substitution and shell variable expansion support accessing only
|
||||
specific items by providing a set of indices in square brackets. It's
|
||||
often needed to access a sequence of elements. To do this, use the range
|
||||
operator '..' for this. A range <code>'a..b'</code>, where range limits 'a'
|
||||
|
@ -799,10 +799,12 @@ If the current directory contains the files 'foo' and 'bar', the command
|
|||
will output 'abar1 abar2 abar3 afoo1 afoo2 afoo3'.
|
||||
|
||||
|
||||
\section variables Environment variables
|
||||
\section variables Shell variables
|
||||
|
||||
Environment variables are named pieces of data, which can be created, deleted
|
||||
and their values changed and used by the user.
|
||||
Shell variables are named pieces of data, which can be created, deleted
|
||||
and their values changed and used by the user. Variables may optionally be "exported", so
|
||||
that a copy of the variable is available to any subprocesses the shell creates. An
|
||||
exported variable is referred to as an "environment variable".
|
||||
|
||||
To set a variable value, use the <a href="commands.html#set"> \c set
|
||||
command</a>.
|
||||
|
|
|
@ -14,7 +14,7 @@ or a pipeline.
|
|||
For a description of the syntax supported by math, see the manual for
|
||||
the bc program. Keep in mind that parameter expansion takes place on
|
||||
any expressions before they are evaluated. This can be very useful in
|
||||
order to perform calculations involving environment variables or the
|
||||
order to perform calculations involving shell variables or the
|
||||
output of command substitutions, but it also means that parenthesis
|
||||
have to be escaped.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
\subsection read-description Description
|
||||
|
||||
<tt>read</tt> reads one line from standard
|
||||
input and stores the result in one or more environment variables.
|
||||
input and stores the result in one or more shell variables.
|
||||
|
||||
The following options are available:
|
||||
|
||||
|
@ -17,17 +17,17 @@ The following options are available:
|
|||
- <tt>-p PROMPT_CMD</tt> or <tt>--prompt=PROMPT_CMD</tt> uses the output of the shell command \c PROMPT_CMD as the prompt for the interactive mode. The default prompt command is <tt>set_color green; echo read; set_color normal; echo "> "</tt>.
|
||||
- <code>-s</code> or <code>--shell</code> enables syntax highlighting, tab completions and command termination suitable for entering shellscript code in the interactive mode.
|
||||
- <code>-u</code> or <code>--unexport</code> prevents the variables from being exported to child processes (default behaviour).
|
||||
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be made universal.
|
||||
- <code>-U</code> or <code>--universal</code> causes the specified shell variable to be made universal.
|
||||
- <code>-x</code> or <code>--export</code> exports the variables to child processes.
|
||||
|
||||
\c read reads a single line of input from stdin, breaks it into tokens
|
||||
based on the <tt>IFS</tt> environment variable, and then assigns one
|
||||
based on the <tt>IFS</tt> shell variable, and then assigns one
|
||||
token to each variable specified in <tt>VARIABLES</tt>. If there are more
|
||||
tokens than variables, the complete remainder is assigned to the last variable.
|
||||
|
||||
\subsection read-example Example
|
||||
|
||||
The following code stores the value 'hello' in the environment variable
|
||||
The following code stores the value 'hello' in the shell variable
|
||||
<tt>$foo</tt>.
|
||||
|
||||
<tt>echo hello|read foo</tt>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
\section set set - display and change environment variables.
|
||||
\section set set - display and change shell variables.
|
||||
|
||||
\subsection set-synopsis Synopsis
|
||||
<pre>
|
||||
|
@ -12,11 +12,11 @@ set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
|||
|
||||
\subsection set-description Description
|
||||
|
||||
<code>set</code> manipulates <a href="index.html#variables">environment
|
||||
<code>set</code> manipulates <a href="index.html#variables">shell
|
||||
variables</a>.
|
||||
|
||||
If set is called with no arguments, the names and values of all
|
||||
environment variables are printed. If some of the scope or export
|
||||
shell variables are printed. If some of the scope or export
|
||||
flags have been given, only the variables matching the specified scope
|
||||
are printed.
|
||||
|
||||
|
@ -24,15 +24,15 @@ With both variable names and values provided, \c set assigns the variable
|
|||
<code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
|
||||
|
||||
The following options control variable scope:
|
||||
- <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>-l</code> or <code>--local</code> forces the specified shell 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 shell 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 shell 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, not their value
|
||||
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
|
||||
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
|
||||
- <code>-x</code> or <code>--export</code> causes the specified shell variable to be exported to child processes (making it an "environment variable")
|
||||
- <code>-u</code> or <code>--unexport</code> causes the specified shell variable to NOT be exported to child processes
|
||||
|
||||
The following options are available:
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified environment variable to be erased
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified shell variable to be erased
|
||||
- <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>-L</code> or <code>--long</code> do not abbreviate long values when printing set variables
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
shell. This is different from starting a new process to perform the
|
||||
commands (i.e. <tt>fish < FILENAME</tt>) since the commands will be
|
||||
evaluated by the current shell, which means that changes in
|
||||
environment variables affect the current shell. If additional arguments are
|
||||
shell variables will affect the current shell. If additional arguments are
|
||||
specified after the file name, they will be inserted into the $argv
|
||||
variable.
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ h3 { font-size: 110%; }
|
|||
<li><a href="#tut_tab_completions"><span class="chevron">›</span> Tab Completions</a></li>
|
||||
<li><a href="#tut_variables"><span class="chevron">›</span> Variables</a></li>
|
||||
<li><a href="#tut_exit_status"><span class="chevron">›</span> Exit Status</a></li>
|
||||
<li><a href="#tut_exports"><span class="chevron">›</span> Environment Variables</a></li>
|
||||
<li><a href="#tut_exports"><span class="chevron">›</span> Shell Variables</a></li>
|
||||
<li><a href="#tut_lists"><span class="chevron">›</span> Lists</a></li>
|
||||
<li><a href="#tut_command_substitutions"><span class="chevron">›</span> Command Substitutions</a></li>
|
||||
<li><a href="#tut_combiners"><span class="chevron">›</span> Combiners (And, Or, Not)</a></li>
|
||||
|
@ -258,7 +258,7 @@ fish has excellent help and man pages. Run <tt>help</tt> to open help in a web b
|
|||
|
||||
<pre>
|
||||
> <b>man</b> <i>set</i>
|
||||
set - handle environment variables
|
||||
set - handle shell variables
|
||||
Synopsis...
|
||||
</pre>
|
||||
|
||||
|
@ -429,7 +429,7 @@ Unlike other shells, fish stores the exit status of the last command in <tt>$sta
|
|||
|
||||
Zero is considered success, and non-zero is failure.
|
||||
|
||||
<h2 id="tut_exports">Exports (Environment Variables)</h2>
|
||||
<h2 id="tut_exports">Exports (Shell Variables)</h2>
|
||||
|
||||
Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to <tt>set</tt>, either <tt>--export</tt> or just <tt>-x</tt>.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user