mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Make line length, wrapping and spacing consistent
This commit is contained in:
parent
d7308fecbe
commit
137abd0cfa
72 changed files with 807 additions and 1292 deletions
|
@ -13,10 +13,12 @@ alias NAME=DEFINITION
|
||||||
`fish` does not keep track of which functions have been defined using `alias`. They must be erased using `functions -e`.
|
`fish` does not keep track of which functions have been defined using `alias`. They must be erased using `functions -e`.
|
||||||
|
|
||||||
- `NAME` is the name of the alias
|
- `NAME` is the name of the alias
|
||||||
|
|
||||||
- `DEFINITION` is the actual command to execute. The string `$argv` will be appended.
|
- `DEFINITION` is the actual command to execute. The string `$argv` will be appended.
|
||||||
|
|
||||||
You cannot create an alias to a function with the same name.
|
You cannot create an alias to a function with the same name.
|
||||||
|
|
||||||
|
|
||||||
\subsection alias-example Example
|
\subsection alias-example Example
|
||||||
|
|
||||||
The following code will create `rmi`, which runs `rm` with additional arguments on every invocation.
|
The following code will create `rmi`, which runs `rm` with additional arguments on every invocation.
|
||||||
|
|
|
@ -7,21 +7,16 @@ COMMAND1; and COMMAND2
|
||||||
|
|
||||||
\subsection and-description Description
|
\subsection and-description Description
|
||||||
|
|
||||||
`and` is used to execute a command if the current exit
|
`and` is used to execute a command if the current exit status (as set by the last previous command) is 0.
|
||||||
status (as set by the last previous command) is 0.
|
|
||||||
|
|
||||||
`and` does not change the current exit status.
|
`and` does not change the current exit status.
|
||||||
|
|
||||||
The exit status of the last foreground command to exit can always be
|
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||||
accessed using the <a href="index.html#variables-status">$status</a>
|
|
||||||
variable.
|
|
||||||
|
|
||||||
\subsection and-example Example
|
\subsection and-example Example
|
||||||
|
|
||||||
The following code runs the `make` command to build a program. If the
|
The following code runs the `make` command to build a program. If the build succeeds, `make`'s exit status is 0, and the program is installed. If either step fails, the exit status is 1, and `make clean` is run, which removes the files created by the build process.
|
||||||
build succeeds, `make`'s exit status is 0, and the program is installed. If either step fails,
|
|
||||||
the exit status is 1, and `make clean` is run, which removes the files created by the.
|
|
||||||
build process.
|
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
make; and make install; or make clean
|
make; and make install; or make clean
|
||||||
|
|
|
@ -9,21 +9,16 @@ begin; [COMMANDS...;] end
|
||||||
|
|
||||||
`begin` is used to create a new block of code.
|
`begin` is used to create a new block of code.
|
||||||
|
|
||||||
The block is unconditionally executed. `begin; ...; end` is equivalent
|
The block is unconditionally executed. `begin; ...; end` is equivalent to `if true; ...; end`.
|
||||||
to `if true; ...; end`.
|
|
||||||
|
|
||||||
`begin` is used to group a number of commands into a block.
|
`begin` is used to group a number of commands into a block. This allows the introduction of a new variable scope, redirection of the input or output of a set of commands as a group, or to specify precedence when using the conditional commands like `and`.
|
||||||
This allows the introduction of a new variable scope, redirection of the input or
|
|
||||||
output of a set of commands as a group, or to specify precedence when
|
|
||||||
using the conditional commands like `and`.
|
|
||||||
|
|
||||||
`begin` does not change the current exit status.
|
`begin` does not change the current exit status.
|
||||||
|
|
||||||
|
|
||||||
\subsection begin-example Example
|
\subsection begin-example Example
|
||||||
|
|
||||||
The following code sets a number of variables inside of a block
|
The following code sets a number of variables inside of a block scope. Since the variables are set inside the block and have local scope, they will be automatically deleted when the block ends.
|
||||||
scope. Since the variables are set inside the block and have local
|
|
||||||
scope, they will be automatically deleted when the block ends.
|
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
begin
|
begin
|
||||||
|
@ -32,8 +27,8 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
echo $PIRATE
|
echo $PIRATE
|
||||||
# This will not output anything, since the PIRATE variable went out
|
# This will not output anything, since the PIRATE variable
|
||||||
# of scope at the end of the block
|
# went out of scope at the end of the block
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
In the following code, all output is redirected to the file out.html.
|
In the following code, all output is redirected to the file out.html.
|
||||||
|
|
|
@ -7,13 +7,11 @@ bg [PID...]
|
||||||
|
|
||||||
\subsection bg-description Description
|
\subsection bg-description Description
|
||||||
|
|
||||||
`bg` sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is
|
`bg` sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
||||||
executed simultaneously with fish, and does not have access to the
|
|
||||||
keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
|
||||||
|
|
||||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
||||||
|
|
||||||
|
|
||||||
\subsection bg-example Example
|
\subsection bg-example Example
|
||||||
|
|
||||||
`bg %1` will put the job with job ID 1 in the background.
|
`bg %1` will put the job with job ID 1 in the background.
|
||||||
|
|
||||||
|
|
|
@ -10,82 +10,83 @@ bind [OPTIONS] SEQUENCE COMMAND
|
||||||
`bind` adds a binding for the specified key sequence to the
|
`bind` adds a binding for the specified key sequence to the
|
||||||
specified command.
|
specified command.
|
||||||
|
|
||||||
SEQUENCE is the character sequence to bind to. These should be written as <a
|
SEQUENCE is the character sequence to bind to. These should be written as <a href="index.html#escapes">fish escape sequences</a>. For example, because pressing the Alt key and another character sends that character prefixed with an escape character, Alt-based key bindings can be written using the `\e` escape. For example, @key{Alt,w} can be written as `\ew`. The control character can be written in much the same way using the `\c` escape, for example @key{Control,X} (^X) can be written as `\cx`. Note that Alt-based key bindings are case sensitive and Control-based key bindings are not. This is a constraint of text-based terminals, not `fish`.
|
||||||
href="index.html#escapes">fish escape sequences</a>. For example, because
|
|
||||||
pressing the Alt key and another character sends that character prefixed with
|
|
||||||
an escape character, Alt-based key bindings can be written using the `\e`
|
|
||||||
escape. For example, @key{Alt,w} can be written as `\ew`. The control
|
|
||||||
character can be written in much the same way using the `\c` escape, for
|
|
||||||
example @key{Control,X} (^X) can be written as `\cx`. Note
|
|
||||||
that Alt-based key bindings are case sensitive and Control-based key bindings
|
|
||||||
are not. This is a constraint of text-based terminals, not `fish`.
|
|
||||||
|
|
||||||
The default key binding can be set by specifying a `SEQUENCE` of the empty
|
The default key binding can be set by specifying a `SEQUENCE` of the empty string (that is, ```''``` ). It will be used whenever no other binding matches. For most key bindings, it makes sense to use the `self-insert` function (i.e. ```bind '' self-insert```) as the default keybinding. This will insert any keystrokes not specifically bound to into the editor. Non- printable characters are ignored by the editor, so this will not result in control sequences being printable.
|
||||||
string (that is, ```''``` ). It will be used whenever no other binding
|
|
||||||
matches. For most key bindings, it makes sense to use the `self-insert`
|
|
||||||
function (i.e. ```bind '' self-insert```) as the default keybinding. This
|
|
||||||
will insert any keystrokes not specifically bound to into the editor. Non-
|
|
||||||
printable characters are ignored by the editor, so this will not result in
|
|
||||||
control sequences being printable.
|
|
||||||
|
|
||||||
If the `-k` switch is used, the name of the key (such as 'down', 'up' or 'backspace')
|
If the `-k` switch is used, the name of the key (such as 'down', 'up' or 'backspace') is used instead of a sequence. The names used are the same as the corresponding curses variables, but without the 'key_' prefix. (See `terminfo(5)` for more information, or use `bind --key-names` for a list of all available named keys.)
|
||||||
is used instead of a sequence. The names used are the same as the
|
|
||||||
corresponding curses variables, but without the 'key_' prefix. (See
|
|
||||||
`terminfo(5)` for more information, or use `bind --key-names` for a list of all
|
|
||||||
available named keys.)
|
|
||||||
|
|
||||||
`COMMAND` can be any fish command, but it can also be one of a set of special
|
`COMMAND` can be any fish command, but it can also be one of a set of special input functions. These include functions for moving the cursor, operating on the kill-ring, performing tab completion, etc. Use `bind --function-names` for a complete list of these input functions.
|
||||||
input functions. These include functions for moving the cursor, operating on
|
|
||||||
the kill-ring, performing tab completion, etc. Use `bind --function-names` for
|
|
||||||
a complete list of these input functions.
|
|
||||||
|
|
||||||
When `COMMAND` is a shellscript command, it is a good practice to put the actual
|
When `COMMAND` is a shellscript command, it is a good practice to put the actual code into a <a href="#function">function</a> and simply bind to the function name. This way it becomes significantly easier to test the function while editing, and the result is usually more readable as well.
|
||||||
code into a <a href="#function">function</a> and simply bind to the function
|
|
||||||
name. This way it becomes significantly easier to test the function while
|
|
||||||
editing, and the result is usually more readable as well.
|
|
||||||
|
|
||||||
If such a script produces output, the script needs to finish by calling
|
If such a script produces output, the script needs to finish by calling `commandline -f repaint` in order to tell fish that a repaint is in order.
|
||||||
`commandline -f repaint` in order to tell fish that a repaint is in order.
|
|
||||||
|
|
||||||
Key bindings are not saved between sessions by default. To save custom
|
Key bindings are not saved between sessions by default. To save custom keybindings, edit the `fish_user_key_bindings` function and insert the appropriate `bind` statements.
|
||||||
keybindings, edit the `fish_user_key_bindings` function and insert the
|
|
||||||
appropriate `bind` statements.
|
|
||||||
|
|
||||||
The following parameters are available:
|
The following parameters are available:
|
||||||
|
|
||||||
- `-k` or `--key` Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
- `-k` or `--key` Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
||||||
|
|
||||||
- `-K` or `--key-names` Display a list of available key names
|
- `-K` or `--key-names` Display a list of available key names
|
||||||
|
|
||||||
- `-f` or `--function-names` Display a list of available input functions
|
- `-f` or `--function-names` Display a list of available input functions
|
||||||
|
|
||||||
The following special input functions are available:
|
The following special input functions are available:
|
||||||
|
|
||||||
- `backward-char`, moves one character to the left
|
- `backward-char`, moves one character to the left
|
||||||
|
|
||||||
- `backward-delete-char`, deletes one character of input to the left of the cursor
|
- `backward-delete-char`, deletes one character of input to the left of the cursor
|
||||||
|
|
||||||
- `backward-kill-line`, move everything from the beginning of the line to the cursor to the killring
|
- `backward-kill-line`, move everything from the beginning of the line to the cursor to the killring
|
||||||
|
|
||||||
- `backward-kill-word`, move the word to the left of the cursor to the killring
|
- `backward-kill-word`, move the word to the left of the cursor to the killring
|
||||||
|
|
||||||
- `backward-word`, move one word to the left
|
- `backward-word`, move one word to the left
|
||||||
|
|
||||||
- `beginning-of-history`, move to the beginning of the history
|
- `beginning-of-history`, move to the beginning of the history
|
||||||
|
|
||||||
- `beginning-of-line`, move to the beginning of the line
|
- `beginning-of-line`, move to the beginning of the line
|
||||||
|
|
||||||
- `capitalize-word`, make the current word begin with a capital letter
|
- `capitalize-word`, make the current word begin with a capital letter
|
||||||
|
|
||||||
- `complete`, guess the remainder of the current token
|
- `complete`, guess the remainder of the current token
|
||||||
|
|
||||||
- `delete-char`, delete one character to the right of the cursor
|
- `delete-char`, delete one character to the right of the cursor
|
||||||
|
|
||||||
- `delete-line`, delete the entire line
|
- `delete-line`, delete the entire line
|
||||||
|
|
||||||
- `downcase-word`, make the current word lowercase
|
- `downcase-word`, make the current word lowercase
|
||||||
|
|
||||||
- `dump-functions`, print a list of all key-bindings
|
- `dump-functions`, print a list of all key-bindings
|
||||||
|
|
||||||
- `end-of-history`, move to the end of the history
|
- `end-of-history`, move to the end of the history
|
||||||
|
|
||||||
- `end-of-line`, move to the end of the line
|
- `end-of-line`, move to the end of the line
|
||||||
|
|
||||||
- `explain`, print a description of possible problems with the current command
|
- `explain`, print a description of possible problems with the current command
|
||||||
|
|
||||||
- `forward-char`, move one character to the right
|
- `forward-char`, move one character to the right
|
||||||
|
|
||||||
- `forward-word`, move one word to the right
|
- `forward-word`, move one word to the right
|
||||||
|
|
||||||
- `history-search-backward`, search the history for the previous match
|
- `history-search-backward`, search the history for the previous match
|
||||||
|
|
||||||
- `history-search-forward`, search the history for the next match
|
- `history-search-forward`, search the history for the next match
|
||||||
|
|
||||||
- `kill-line`, move everything from the cursor to the end of the line to the killring
|
- `kill-line`, move everything from the cursor to the end of the line to the killring
|
||||||
|
|
||||||
- `kill-whole-line`, move the line to the killring
|
- `kill-whole-line`, move the line to the killring
|
||||||
|
|
||||||
- `kill-word`, move the next word to the killring
|
- `kill-word`, move the next word to the killring
|
||||||
|
|
||||||
- `upcase-word`, make the current word uppercase
|
- `upcase-word`, make the current word uppercase
|
||||||
|
|
||||||
- `yank`, insert the latest entry of the killring into the buffer
|
- `yank`, insert the latest entry of the killring into the buffer
|
||||||
|
|
||||||
- `yank-pop`, rotate to the previous entry of the killring
|
- `yank-pop`, rotate to the previous entry of the killring
|
||||||
|
|
||||||
|
|
||||||
\subsection bind-example Examples
|
\subsection bind-example Examples
|
||||||
|
|
||||||
`bind \cd 'exit'` causes `fish` to exit when @key{Control,D} is pressed.
|
`bind \cd 'exit'` causes `fish` to exit when @key{Control,D} is pressed.
|
||||||
|
|
|
@ -7,26 +7,23 @@ block [OPTIONS...]
|
||||||
|
|
||||||
\subsection block-description Description
|
\subsection block-description Description
|
||||||
|
|
||||||
`block` prevents events triggered by `fish` or the
|
`block` prevents events triggered by `fish` or the <a href="commands.html#emit">`emit`</a> command from being delivered and acted upon while the block is in place.
|
||||||
<a href="commands.html#emit">`emit`</a> command from
|
|
||||||
being delivered and acted upon while the block is in place.
|
|
||||||
|
|
||||||
In functions, `block` can be useful while performing work that
|
In functions, `block` can be useful while performing work that should not be interrupted by the shell.
|
||||||
should not be interrupted by the shell.
|
|
||||||
|
|
||||||
The block can be removed. Any events which triggered while the
|
The block can be removed. Any events which triggered while the block was in place will then be delivered.
|
||||||
block was in place will then be delivered.
|
|
||||||
|
|
||||||
Event blocks should not be confused with code blocks, which are created
|
Event blocks should not be confused with code blocks, which are created with `begin`, `if`, `while` or `for`
|
||||||
with `begin`, `if`, `while` or
|
|
||||||
`for`
|
|
||||||
|
|
||||||
The following parameters are available:
|
The following parameters are available:
|
||||||
|
|
||||||
- `-l` or `--local` Release the block automatically at the end of the current innermost code block scope
|
- `-l` or `--local` Release the block automatically at the end of the current innermost code block scope
|
||||||
|
|
||||||
- `-g` or `--global` Never automatically release the lock
|
- `-g` or `--global` Never automatically release the lock
|
||||||
|
|
||||||
- `-e` or `--erase` Release global block
|
- `-e` or `--erase` Release global block
|
||||||
|
|
||||||
|
|
||||||
\subsection block-example Example
|
\subsection block-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
|
LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
\subsection break-description Description
|
\subsection break-description Description
|
||||||
|
|
||||||
`break` halts a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. 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.
|
`break` halts a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. 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.
|
||||||
|
|
||||||
There are no parameters for `break`.
|
There are no parameters for `break`.
|
||||||
|
|
||||||
|
|
||||||
\subsection break-example Example
|
\subsection break-example Example
|
||||||
The following code searches all .c files for "smurf", and halts at the first occurrence.
|
The following code searches all .c files for "smurf", and halts at the first occurrence.
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,8 @@ breakpoint
|
||||||
|
|
||||||
\subsection breakpoint-description Description
|
\subsection breakpoint-description Description
|
||||||
|
|
||||||
`breakpoint` is used to halt a running script and launch
|
`breakpoint` is used to halt a running script and launch an interactive debugging prompt.
|
||||||
an interactive debugging prompt.
|
|
||||||
|
|
||||||
For more details, see <a href="index.html#debugging">Debugging fish
|
For more details, see <a href="index.html#debugging">Debugging fish scripts</a> in the `fish` manual.
|
||||||
scripts</a> in the `fish` manual.
|
|
||||||
|
|
||||||
There are no parameters for `breakpoint`.
|
There are no parameters for `breakpoint`.
|
||||||
|
|
|
@ -13,6 +13,10 @@ The following parameters are available:
|
||||||
|
|
||||||
- `-n` or `--names` List the names of all defined builtins
|
- `-n` or `--names` List the names of all defined builtins
|
||||||
|
|
||||||
|
|
||||||
\subsection builtin-example Example
|
\subsection builtin-example Example
|
||||||
|
|
||||||
`builtin jobs` executes the jobs builtin, even if a function named jobs exists.
|
\fish
|
||||||
|
builtin jobs
|
||||||
|
# executes the jobs builtin, even if a function named jobs exists
|
||||||
|
\endfish
|
||||||
|
|
|
@ -7,24 +7,14 @@ switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||||
|
|
||||||
\subsection case-description Description
|
\subsection case-description Description
|
||||||
|
|
||||||
`switch` performs one of several blocks of commands, depending on whether
|
`switch` performs one of several blocks of commands, depending on whether a specified value equals one of several wildcarded values. `case` is used together with the `switch` statement in order to determine which block should be executed.
|
||||||
a specified value equals one of several wildcarded values. `case` is used
|
|
||||||
together with the `switch` statement in order to determine which block should
|
|
||||||
be executed.
|
|
||||||
|
|
||||||
Each `case` command is given one or more parameters. The first `case`
|
Each `case` command is given one or more parameters. The first `case` command with a parameter that matches the string specified in the switch command will be evaluated. `case` parameters may contain wildcards. These need to be escaped or quoted in order to avoid regular wildcard expansion using filenames.
|
||||||
command with a parameter that matches the string specified in the
|
|
||||||
switch command will be evaluated. `case` parameters may contain
|
|
||||||
wildcards. These need to be escaped or quoted in order to avoid
|
|
||||||
regular wildcard expansion using filenames.
|
|
||||||
|
|
||||||
Note that fish does not fall through on case statements. Only the
|
Note that fish does not fall through on case statements. Only the first matching case is executed.
|
||||||
first matching case is executed.
|
|
||||||
|
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.
|
||||||
|
|
||||||
Note that command substitutions in a case statement will be
|
|
||||||
evaluated even if its body is not taken. All substitutions, including
|
|
||||||
command substitutions, must be performed before the value can be compared
|
|
||||||
against the parameter.
|
|
||||||
|
|
||||||
\subsection case-example Example
|
\subsection case-example Example
|
||||||
|
|
||||||
|
|
|
@ -8,20 +8,19 @@ cd [DIRECTORY]
|
||||||
\subsection cd-description Description
|
\subsection cd-description Description
|
||||||
`cd` changes the current working directory.
|
`cd` changes the current working directory.
|
||||||
|
|
||||||
If `DIRECTORY` is supplied, it will become the new directory. If no parameter
|
If `DIRECTORY` is supplied, it will become the new directory. If no parameter is given, the contents of the `HOME` environment variable will be used.
|
||||||
is given, the contents of the `HOME` environment variable will be used.
|
|
||||||
|
|
||||||
If `DIRECTORY` is a relative path, the paths found in the
|
If `DIRECTORY` is a relative path, the paths found in the `CDPATH` environment variable array will be tried as prefixes for the specified path.
|
||||||
`CDPATH` environment variable array will be tried as prefixes for the specified
|
|
||||||
path.
|
Note that the shell will attempt to change directory without requiring `cd` if the name of a directory is provided (starting with `.`, `/` or `~`, or ending with `/`).
|
||||||
|
|
||||||
Note that the shell will attempt to change directory without requiring `cd`
|
|
||||||
if the name of a directory is provided (starting with '`.`', '`/`' or `~`', or ending
|
|
||||||
with '`/`').
|
|
||||||
|
|
||||||
\subsection cd-example Examples
|
\subsection cd-example Examples
|
||||||
|
|
||||||
`cd` changes the working directory to your home directory.
|
\fish
|
||||||
|
cd
|
||||||
|
# changes the working directory to your home directory.
|
||||||
|
|
||||||
`cd /usr/src/fish-shell` changes the working directory to
|
cd /usr/src/fish-shell
|
||||||
`/usr/src/fish-shell`.
|
# changes the working directory to /usr/src/fish-shell
|
||||||
|
\endfish
|
||||||
|
|
|
@ -7,69 +7,53 @@ commandline [OPTIONS] [CMD]
|
||||||
|
|
||||||
\subsection commandline-description Description
|
\subsection commandline-description Description
|
||||||
|
|
||||||
`commandline` can be used to set or get the current contents of the command
|
`commandline` can be used to set or get the current contents of the command line buffer.
|
||||||
line buffer.
|
|
||||||
|
|
||||||
With no parameters, `commandline` returns the current value of the command
|
With no parameters, `commandline` returns the current value of the command line.
|
||||||
line.
|
|
||||||
|
|
||||||
With `CMD` specified, the command line buffer is erased and replaced with
|
With `CMD` specified, the command line buffer is erased and replaced with the contents of `CMD`.
|
||||||
the contents of `CMD`.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-C` or `--cursor` set or get the current cursor position, not
|
- `-C` or `--cursor` set or get the current cursor position, not the contents of the buffer. If no argument is given, the current cursor position is printed, otherwise the argument is interpreted as the new cursor position.
|
||||||
the contents of the buffer. If no argument is given, the current
|
|
||||||
cursor position is printed, otherwise the argument is interpreted
|
|
||||||
as the new cursor position.
|
|
||||||
- `-f` or `--function` inject readline functions into the
|
|
||||||
reader. This option cannot be combined with any other option. It
|
|
||||||
will cause any additional arguments to be interpreted as readline
|
|
||||||
functions, and these functions will be injected into the reader, so
|
|
||||||
that they will be returned to the reader before any additional
|
|
||||||
actual key presses are read.
|
|
||||||
|
|
||||||
The following options change the way `commandline` updates the
|
- `-f` or `--function` inject readline functions into the reader. This option cannot be combined with any other option. It will cause any additional arguments to be interpreted as readline functions, and these functions will be injected into the reader, so that they will be returned to the reader before any additional actual key presses are read.
|
||||||
command line buffer:
|
|
||||||
|
|
||||||
- `-a` or `--append` do not remove the current commandline, append
|
The following options change the way `commandline` updates the command line buffer:
|
||||||
the specified string at the end of it
|
|
||||||
- `-i` or `--insert` do not remove the current commandline, insert
|
|
||||||
the specified string at the current cursor position
|
|
||||||
- `-r` or `--replace` remove the current commandline and replace it
|
|
||||||
with the specified string (default)
|
|
||||||
|
|
||||||
The following options change what part of the commandline is printed
|
- `-a` or `--append` do not remove the current commandline, append the specified string at the end of it
|
||||||
or updated:
|
|
||||||
|
- `-i` or `--insert` do not remove the current commandline, insert the specified string at the current cursor position
|
||||||
|
|
||||||
|
- `-r` or `--replace` remove the current commandline and replace it with the specified string (default)
|
||||||
|
|
||||||
|
The following options change what part of the commandline is printed or updated:
|
||||||
|
|
||||||
- `-b` or `--current-buffer` select the entire buffer (default)
|
- `-b` or `--current-buffer` select the entire buffer (default)
|
||||||
|
|
||||||
- `-j` or `--current-job` select the current job
|
- `-j` or `--current-job` select the current job
|
||||||
|
|
||||||
- `-p` or `--current-process` select the current process
|
- `-p` or `--current-process` select the current process
|
||||||
|
|
||||||
- `-t` or `--current-token` select the current token.
|
- `-t` or `--current-token` select the current token.
|
||||||
|
|
||||||
The following options change the way `commandline` prints the current
|
The following options change the way `commandline` prints the current commandline buffer:
|
||||||
commandline buffer:
|
|
||||||
|
- `-c` or `--cut-at-cursor` only print selection up until the current cursor position
|
||||||
|
|
||||||
- `-c` or `--cut-at-cursor` only print selection up until the
|
|
||||||
current cursor position
|
|
||||||
- `-o` or `--tokenize` tokenize the selection and print one string-type token per line
|
- `-o` or `--tokenize` tokenize the selection and print one string-type token per line
|
||||||
|
|
||||||
|
If `commandline` is called during a call to complete a given string using `complete -C STRING`, `commandline` will consider the specified string to be the current contents of the command line.
|
||||||
If `commandline` is called during a call to complete a given string
|
|
||||||
using `complete -C STRING`, `commandline` will consider the
|
|
||||||
specified string to be the current contents of the command line.
|
|
||||||
|
|
||||||
The following options output metadata about the commandline state:
|
The following options output metadata about the commandline state:
|
||||||
|
|
||||||
- `-L` or `--line` print the line that the cursor is on, with the topmost
|
- `-L` or `--line` print the line that the cursor is on, with the topmost line starting at 1
|
||||||
line starting at 1
|
|
||||||
- `-S` or `--search-mode` evaluates to true if the commandline is performing
|
- `-S` or `--search-mode` evaluates to true if the commandline is performing a history search
|
||||||
a history search
|
|
||||||
- `-P` or `--paging-mode` evaluates to true if the commandline is showing
|
- `-P` or `--paging-mode` evaluates to true if the commandline is showing pager contents, such as tab completions
|
||||||
pager contents, such as tab completions
|
|
||||||
|
|
||||||
|
|
||||||
\subsection commandline-example Example
|
\subsection commandline-example Example
|
||||||
|
|
||||||
`commandline -j $history[3]` replaces the job under the cursor with the
|
`commandline -j $history[3]` replaces the job under the cursor with the third item from the command line history.
|
||||||
third item from the command line history.
|
|
||||||
|
|
|
@ -34,62 +34,43 @@ options, the same styles as the GNU version of the getopt
|
||||||
library. These styles are:
|
library. These styles are:
|
||||||
|
|
||||||
- Short options, like '`-a`'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '`-la`', which is equivalent to '`-l -a`'). Option arguments may be specified in the following parameter ('`-w 32`') or by appending the option with the value ('`-w32`').
|
- Short options, like '`-a`'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '`-la`', which is equivalent to '`-l -a`'). Option arguments may be specified in the following parameter ('`-w 32`') or by appending the option with the value ('`-w32`').
|
||||||
|
|
||||||
- Old style long options, like '`-Wall`'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('`-ao null`').
|
- Old style long options, like '`-Wall`'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('`-ao null`').
|
||||||
|
|
||||||
- GNU style long options, like '`--colors`'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('`--quoting-style`') or by appending the option with a '`=`' and the value ('`--quoting-style=shell`'). GNU style long options may be abbreviated so long as the abbreviation is unique ('`--h`') is equivalent to '`--help`' if help is the only long option beginning with an 'h').
|
- GNU style long options, like '`--colors`'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('`--quoting-style`') or by appending the option with a '`=`' and the value ('`--quoting-style=shell`'). GNU style long options may be abbreviated so long as the abbreviation is unique ('`--h`') is equivalent to '`--help`' if help is the only long option beginning with an 'h').
|
||||||
|
|
||||||
The options for specifying command name, command path, or command
|
The options for specifying command name, command path, or command switches may all be used multiple times to specify multiple commands which have the same completion or multiple switches accepted by a command.
|
||||||
switches may all be used multiple times to specify multiple commands
|
|
||||||
which have the same completion or multiple switches accepted by a
|
|
||||||
command.
|
|
||||||
|
|
||||||
The \c -w or \c --wraps options causes the specified command to inherit
|
The `-w` or `--wraps` options causes the specified command to inherit completions from another command. The inheriting command is said to "wrap" the inherited command. The wrapping command may have its own completions in addition to inherited ones. A command may wrap multiple commands, and wrapping is transitive: if A wraps B, and B wraps C, then A automatically inherits all of C's completions. Wrapping can be removed using the `-e` or `--erase` options.
|
||||||
completions from another command. The inheriting command is said to
|
|
||||||
"wrap" the inherited command. The wrapping command may have its own
|
When erasing completions, it is possible to either erase all completions for a specific command by specifying `complete -e -c COMMAND`, or by specifying a specific completion option to delete by specifying either a long, short or old style option.
|
||||||
completions in addition to inherited ones. A command may wrap multiple
|
|
||||||
commands, and wrapping is transitive: if A wraps B, and B wraps C,
|
|
||||||
then A automatically inherits all of C's completions. Wrapping can
|
|
||||||
be removed using the \c -e or \c --erase options.
|
|
||||||
|
|
||||||
When erasing completions, it is possible to either erase all
|
|
||||||
completions for a specific command by specifying `complete -e -c
|
|
||||||
COMMAND`, or by specifying a specific completion option to delete
|
|
||||||
by specifying either a long, short or old style option.
|
|
||||||
|
|
||||||
\subsection complete-example Example
|
\subsection complete-example Example
|
||||||
|
|
||||||
The short style option `-o` for the `gcc` command requires
|
The short style option `-o` for the `gcc` command requires that a file follows it. This can be done using writing:
|
||||||
that a file follows it. This can be done using writing:
|
|
||||||
|
|
||||||
`complete -c gcc -s o -r`
|
`complete -c gcc -s o -r`
|
||||||
|
|
||||||
The short style option `-d` for the `grep` command requires
|
The short style option `-d` for the `grep` command requires that one of the strings '`read`', '`skip`' or '`recurse`' is used. This can be specified writing:
|
||||||
that one of the strings '`read`', '`skip`' or '`recurse`' is used. This can
|
|
||||||
be specified writing:
|
|
||||||
|
|
||||||
`complete -c grep -s d -x -a "read skip recurse"`
|
`complete -c grep -s d -x -a "read skip recurse"`
|
||||||
|
|
||||||
The `su` command takes any username as an argument. Usernames are
|
The `su` command takes any username as an argument. Usernames are given as the first colon-separated field in the file /etc/passwd. This can be specified as:
|
||||||
given as the first colon-separated field in the file /etc/passwd. This
|
|
||||||
can be specified as:
|
|
||||||
|
|
||||||
`complete -x -c su -d "Username" `
|
`complete -x -c su -d "Username" -a "(cat /etc/passwd | cut -d : -f 1)"`
|
||||||
`-a "(cat /etc/passwd | cut -d : -f 1)"`
|
|
||||||
|
|
||||||
The `rpm` command has several different modes. If the `-e` or `--erase` flag has been specified, `rpm` should delete one or more
|
The `rpm` command has several different modes. If the `-e` or `--erase` flag has been specified, `rpm` should delete one or more packages, in which case several switches related to deleting packages are valid, like the `nodeps` switch.
|
||||||
packages, in which case several switches related to deleting packages are valid, like the `nodeps` switch.
|
|
||||||
|
|
||||||
This can be written as:
|
This can be written as:
|
||||||
|
|
||||||
`complete -c rpm -n "__fish_contains_opt -s e erase"`
|
`complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d "Don't check dependencies"`
|
||||||
`-l nodeps -d "Don't check dependencies"`
|
|
||||||
|
|
||||||
where `__fish_contains_opt` is a function that checks the commandline
|
where `__fish_contains_opt` is a function that checks the commandline buffer for the presence of a specified set of options.
|
||||||
buffer for the presence of a specified set of options.
|
|
||||||
|
|
||||||
To implement an alias, use the \c -w or \c --wraps option:
|
To implement an alias, use the \c -w or \c --wraps option:
|
||||||
|
|
||||||
<tt>complete -c hub -w git</tt>
|
<tt>complete -c hub -w git</tt>
|
||||||
|
|
||||||
Now hub inherits all of the completions from git. Note this can
|
Now hub inherits all of the completions from git. Note this can also be specified in a function declaration.
|
||||||
also be specified in a function declaration.
|
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,14 @@ contains [OPTIONS] KEY [VALUES...]
|
||||||
|
|
||||||
\subsection contains-description Description
|
\subsection contains-description Description
|
||||||
|
|
||||||
`contains` tests whether the set `VALUES` contains the string
|
`contains` tests whether the set `VALUES` contains the string `KEY`. If so, `contains` exits with status 0; if not, it exits with status 1.
|
||||||
`KEY`. If so, `contains` exits with status 0; if not, it exits
|
|
||||||
with status 1.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-i` or `--index` print the word index
|
- `-i` or `--index` print the word index
|
||||||
- `-h` or `--help` display this message
|
- `-h` or `--help` display this message
|
||||||
|
|
||||||
|
|
||||||
\subsection contains-example Example
|
\subsection contains-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
|
|
|
@ -6,9 +6,11 @@ LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection continue-description Description
|
\subsection continue-description Description
|
||||||
|
|
||||||
`continue` skips the remainder of the current iteration of the current inner loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. 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.
|
`continue` skips the remainder of the current iteration of the current inner loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. 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.
|
||||||
|
|
||||||
\subsection continue-example Example
|
\subsection continue-example Example
|
||||||
|
|
||||||
The following code removes all tmp files that do not contain the word smurf.
|
The following code removes all tmp files that do not contain the word smurf.
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
|
|
|
@ -7,25 +7,21 @@ count $VARIABLE
|
||||||
|
|
||||||
\subsection count-description Description
|
\subsection count-description Description
|
||||||
|
|
||||||
`count` prints the number of arguments that were
|
`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.
|
||||||
passed to it. This is usually used to find out how many elements an
|
|
||||||
environment variable array contains.
|
|
||||||
|
|
||||||
`count` does not accept any options, including '`-h`'.
|
`count` does not accept any options, including '`-h`'.
|
||||||
|
|
||||||
`count` exits with a non-zero exit status if no arguments were passed
|
`count` exits with a non-zero exit status if no arguments were passed to it, and with zero if at least one argument was passed.
|
||||||
to it, and with zero if at least one argument was passed.
|
|
||||||
|
|
||||||
\subsection count-example Example
|
\subsection count-example Example
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
count $PATH
|
count $PATH
|
||||||
</pre>
|
|
||||||
|
|
||||||
returns the number of directories in the users PATH variable.
|
# Returns the number of directories in the users PATH variable.
|
||||||
|
|
||||||
<pre>
|
|
||||||
count *.txt
|
count *.txt
|
||||||
</pre>
|
|
||||||
|
|
||||||
returns the number of files in the current working directory ending with the suffix '.txt'.
|
# Returns the number of files in the current working directory ending with the suffix '.txt'.
|
||||||
|
\endfish
|
|
@ -8,114 +8,87 @@
|
||||||
|
|
||||||
\section design-overview Overview
|
\section design-overview Overview
|
||||||
|
|
||||||
This is a description of the design principles that have been used to
|
This is a description of the design principles that have been used to design fish. The fish design has three high level goals. These are:
|
||||||
design fish. The fish design has three high level goals. These are:
|
|
||||||
|
|
||||||
-# Everything that can be done in other shell languages should be
|
-# Everything that can be done in other shell languages should be possible to do in fish, though fish may rely on external commands in doing so.
|
||||||
possible to do in fish, though fish may rely on external commands in
|
|
||||||
doing so.
|
-# Fish should be user friendly, but not at the expense of expressiveness. Most tradeoffs between power and ease of use can be avoided with careful design.
|
||||||
-# Fish should be user friendly, but not at the expense of expressiveness.
|
|
||||||
Most tradeoffs between power and ease of use can be avoided with careful design.
|
-# Whenever possible without breaking the above goals, fish should follow the Posix syntax.
|
||||||
-# Whenever possible without breaking the above goals, fish should
|
|
||||||
follow the Posix syntax.
|
To achieve these high-level goals, the fish design relies on a number of more specific design principles. These are presented below, together with a rationale and a few examples for each.
|
||||||
|
|
||||||
To achieve these high-level goals, the fish design relies on a number
|
|
||||||
of more specific design principles. These are presented below,
|
|
||||||
together with a rationale and a few examples for each.
|
|
||||||
|
|
||||||
\section ortho The law of orthogonality
|
\section ortho The law of orthogonality
|
||||||
|
|
||||||
The shell language should have a small set of orthogonal features. Any
|
The shell language should have a small set of orthogonal features. Any situation where two features are related but not identical, one of them should be removed, and the other should be made powerful and general enough to handle all common use cases of either feature.
|
||||||
situation where two features are related but not identical, one of them
|
|
||||||
should be removed, and the other should be made powerful and general
|
|
||||||
enough to handle all common use cases of either feature.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
Related features make the language larger, which makes it harder to learn. It also increases the size of the sourcecode, making the program harder to maintain and update.
|
||||||
Related features make the language larger, which makes it harder to
|
|
||||||
learn. It also increases the size of the sourcecode, making the
|
|
||||||
program harder to maintain and update.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Here documents are too similar to using echo inside of a pipeline.
|
- Here documents are too similar to using echo inside of a pipeline.
|
||||||
|
|
||||||
- Subshells, command substitution and process substitution are strongly related. `fish` only supports command substitution, the others can be achieved either using a block or the psub shellscript function.
|
- Subshells, command substitution and process substitution are strongly related. `fish` only supports command substitution, the others can be achieved either using a block or the psub shellscript function.
|
||||||
|
|
||||||
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. `fish` functions have none of the drawbacks of either syntax.
|
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. `fish` functions have none of the drawbacks of either syntax.
|
||||||
|
|
||||||
- The many Posix quoting styles are silly, especially $''.
|
- The many Posix quoting styles are silly, especially $''.
|
||||||
|
|
||||||
\section sep The law of responsiveness
|
|
||||||
|
\section design-response The law of responsiveness
|
||||||
|
|
||||||
The shell should attempt to remain responsive to the user at all times, even in the face of contended or unresponsive filesystems. It is only acceptable to block in response to a user initiated action, such as running a command.
|
The shell should attempt to remain responsive to the user at all times, even in the face of contended or unresponsive filesystems. It is only acceptable to block in response to a user initiated action, such as running a command.
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
|
||||||
Bad performance increases user-facing complexity, because it trains users to recognize and route around slow use cases. It is also incredibly frustrating.
|
Bad performance increases user-facing complexity, because it trains users to recognize and route around slow use cases. It is also incredibly frustrating.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Features like syntax highlighting and autosuggestions must perform all of their disk I/O asynchronously.
|
- Features like syntax highlighting and autosuggestions must perform all of their disk I/O asynchronously.
|
||||||
|
|
||||||
- Startup should minimize forks and disk I/O, so that fish can be started even if the system is under load.
|
- Startup should minimize forks and disk I/O, so that fish can be started even if the system is under load.
|
||||||
|
|
||||||
\section conf Configurability is the root of all evil
|
\section design-configurability Configurability is the root of all evil
|
||||||
|
|
||||||
Every configuration option in a program is a place where the program
|
Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failiure of both the program and the programmer who implemented it.
|
||||||
is too stupid to figure out for itself what the user really wants, and
|
|
||||||
should be considered a failiure of both the program and the programmer
|
|
||||||
who implemented it.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
Different configuration options are a nightmare to maintain, since the number of potential bugs caused by specific configuration combinations quickly becomes an issue. Configuration options often imply assumptions about the code which change when reimplementing the code, causing issues with backwards compatibility. But mostly, configuration options should be avoided since they simply should not exist, as the program should be smart enough to do what is best, or at least a good enough approximation of it.
|
||||||
Different configuration options are a nightmare to maintain, since the
|
|
||||||
number of potential bugs caused by specific configuration combinations
|
|
||||||
quickly becomes an issue. Configuration options often imply
|
|
||||||
assumptions about the code which change when reimplementing the code,
|
|
||||||
causing issues with backwards compatibility. But mostly, configuration
|
|
||||||
options should be avoided since they simply should not exist, as the
|
|
||||||
program should be smart enough to do what is best, or at least a good
|
|
||||||
enough approximation of it.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
||||||
|
|
||||||
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
|
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
|
||||||
|
|
||||||
A special note on the evils of configurability is the long list of
|
A special note on the evils of configurability is the long list of very useful features found in some shells, that are not turned on by default. Both zsh and bash support command specific completions, but no such completions are shipped with bash by default, and they are turned off by default in zsh. Other features that zsh support that are disabled by default include tab-completion of strings containing wildcards, a sane completion pager and a history file.
|
||||||
very useful features found in some shells, that are not turned on by
|
|
||||||
default. Both zsh and bash support command specific completions, but
|
|
||||||
no such completions are shipped with bash by default, and they are
|
|
||||||
turned off by default in zsh. Other features that zsh support that are
|
|
||||||
disabled by default include tab-completion of strings containing
|
|
||||||
wildcards, a sane completion pager and a history file.
|
|
||||||
|
|
||||||
\section user The law of user focus
|
\section user The law of user focus
|
||||||
|
|
||||||
When designing a program, one should first think about how to make a
|
When designing a program, one should first think about how to make a intuitive and powerful program. Implementation issues should only be considered once a user interface has been designed.
|
||||||
intuitive and powerful program. Implementation issues should only be
|
|
||||||
considered once a user interface has been designed.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
This design rule is different than the others, since it describes how one should go about designing new features, not what the features should be. The problem with focusing on what can be done, and what is easy to do, is that to much of the implementation is exposed. This means that the user must know a great deal about the underlying system to be able to guess how the shell works, it also means that the language will often be rather low-level.
|
||||||
This design rule is different than the others, since it describes how
|
|
||||||
one should go about designing new features, not what the features
|
|
||||||
should be. The problem with focusing on what can be done, and what is
|
|
||||||
easy to do, is that to much of the implementation is exposed. This
|
|
||||||
means that the user must know a great deal about the underlying system
|
|
||||||
to be able to guess how the shell works, it also means that the
|
|
||||||
language will often be rather low-level.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
||||||
|
|
||||||
- The differences between builtin commands and shellscript functions should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
|
- The differences between builtin commands and shellscript functions should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
|
||||||
|
|
||||||
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
|
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
|
||||||
|
|
||||||
- All blocks end with the `end` builtin.
|
- All blocks end with the `end` builtin.
|
||||||
|
|
||||||
|
|
||||||
\section disc The law of discoverability
|
\section disc The law of discoverability
|
||||||
|
|
||||||
A program should be designed to make its features as
|
A program should be designed to make its features as easy as possible to discover for the user.
|
||||||
easy as possible to discover for the user.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
A program whose features are discoverable turns a new user into an expert in a shorter span of time, since the user will become an expert on the program simply by using it.
|
||||||
|
|
||||||
A program whose features are discoverable turns a new user into an
|
A program whose features are discoverable turns a new user into an
|
||||||
expert in a shorter span of time, since the user will become an expert
|
expert in a shorter span of time, since the user will become an expert
|
||||||
|
@ -131,12 +104,16 @@ different program, and then she/he remembers the new information
|
||||||
until the next time she/he uses the same program.
|
until the next time she/he uses the same program.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Everything should be tab-completable, and every tab completion should have a description.
|
- Everything should be tab-completable, and every tab completion should have a description.
|
||||||
|
|
||||||
- Every syntax error and error in a builtin command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
- Every syntax error and error in a builtin command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
||||||
|
|
||||||
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
|
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
|
||||||
|
|
||||||
- The language should be uniform, so that once the user understands the command/argument syntax, he will know the whole language, and be able to use tab-completion to discover new featues.
|
- The language should be uniform, so that once the user understands the command/argument syntax, he will know the whole language, and be able to use tab-completion to discover new featues.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\htmlonly[block]
|
\htmlonly[block]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,8 +7,6 @@ dirh
|
||||||
|
|
||||||
\subsection dirh-description Description
|
\subsection dirh-description Description
|
||||||
|
|
||||||
`dirh` prints the current directory history. The current position in the
|
`dirh` prints the current directory history. The current position in the history is highlighted using the color defined in the `fish_color_history_current` environment variable.
|
||||||
history is highlighted using the color defined in the
|
|
||||||
`fish_color_history_current` environment variable.
|
|
||||||
|
|
||||||
`dirh` does not accept any parameters.
|
`dirh` does not accept any parameters.
|
||||||
|
|
|
@ -6,7 +6,7 @@ dirs
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection dirs-description Description
|
\subsection dirs-description Description
|
||||||
`dirs` prints the current directory stack, as created by the
|
|
||||||
<a href="#pushd">`pushd`</a> command.
|
`dirs` prints the current directory stack, as created by the <a href="#pushd">`pushd`</a> command.
|
||||||
|
|
||||||
`dirs` does not accept any parameters.
|
`dirs` does not accept any parameters.
|
||||||
|
|
|
@ -12,9 +12,13 @@ echo [OPTIONS] [STRING]
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-n`, Do not output a newline
|
- `-n`, Do not output a newline
|
||||||
|
|
||||||
- `-s`, Do not separate arguments with spaces
|
- `-s`, Do not separate arguments with spaces
|
||||||
|
|
||||||
- `-E`, Disable interpretation of backslash escapes (default)
|
- `-E`, Disable interpretation of backslash escapes (default)
|
||||||
|
|
||||||
- `-e`, Enable interpretation of backslash escapes
|
- `-e`, Enable interpretation of backslash escapes
|
||||||
|
|
||||||
- `-h`, `--help` Display this help
|
- `-h`, `--help` Display this help
|
||||||
|
|
||||||
\subsection echo-escapes Escape Sequences
|
\subsection echo-escapes Escape Sequences
|
||||||
|
@ -22,20 +26,35 @@ The following options are available:
|
||||||
If `-e` is used, the following sequences are recognized:
|
If `-e` is used, the following sequences are recognized:
|
||||||
|
|
||||||
- `\` backslash
|
- `\` backslash
|
||||||
|
|
||||||
- `\a` alert (BEL)
|
- `\a` alert (BEL)
|
||||||
|
|
||||||
- `\b` backspace
|
- `\b` backspace
|
||||||
|
|
||||||
- `\c` produce no further output
|
- `\c` produce no further output
|
||||||
|
|
||||||
- `\e` escape
|
- `\e` escape
|
||||||
|
|
||||||
- `\f` form feed
|
- `\f` form feed
|
||||||
|
|
||||||
- `\n` new line
|
- `\n` new line
|
||||||
|
|
||||||
- `\r` carriage return
|
- `\r` carriage return
|
||||||
|
|
||||||
- `\t` horizontal tab
|
- `\t` horizontal tab
|
||||||
|
|
||||||
- `\v` vertical tab
|
- `\v` vertical tab
|
||||||
|
|
||||||
- `\0NNN` byte with octal value NNN (1 to 3 digits)
|
- `\0NNN` byte with octal value NNN (1 to 3 digits)
|
||||||
|
|
||||||
- `\xHH` byte with hexadecimal value HH (1 to 2 digits)
|
- `\xHH` byte with hexadecimal value HH (1 to 2 digits)
|
||||||
|
|
||||||
\subsection echo-example Example
|
\subsection echo-example Example
|
||||||
|
|
||||||
`echo 'Hello World'` Print hello world to stdout
|
\fish
|
||||||
|
echo 'Hello World'
|
||||||
|
# Print hello world to stdout
|
||||||
|
|
||||||
`echo -e 'Top\nBottom'` Print Top and Bottom on separate lines, using an escape sequence
|
echo -e 'Top\nBottom'
|
||||||
|
# Print Top and Bottom on separate lines, using an escape sequence
|
||||||
|
\endfish
|
||||||
|
|
|
@ -6,13 +6,13 @@ if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection else-description Description
|
\subsection else-description Description
|
||||||
`if` will execute the command `CONDITION`. If the condition's exit
|
|
||||||
status is 0, the commands `COMMANDS_TRUE` will execute. If it is not 0 and
|
`if` will execute the command `CONDITION`. If the condition's exit status is 0, the commands `COMMANDS_TRUE` will execute. If it is not 0 and `else` is given, `COMMANDS_FALSE` will be executed.
|
||||||
`else` is given, `COMMANDS_FALSE` will be executed.
|
|
||||||
|
|
||||||
\subsection else-example Example
|
\subsection else-example Example
|
||||||
|
|
||||||
The following code tests whether a file `foo`.txt exists as a regular file.
|
The following code tests whether a file `foo.txt` exists as a regular file.
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
if test -f foo.txt
|
if test -f foo.txt
|
||||||
|
|
|
@ -9,10 +9,10 @@ emit EVENT_NAME [ARGUMENTS...]
|
||||||
|
|
||||||
`emit` emits, or fires, an event. Events are delivered to, or caught by, special functions called event handlers. The arguments are passed to the event handlers as function arguments.
|
`emit` emits, or fires, an event. Events are delivered to, or caught by, special functions called event handlers. The arguments are passed to the event handlers as function arguments.
|
||||||
|
|
||||||
|
|
||||||
\subsection emit-example Example
|
\subsection emit-example Example
|
||||||
|
|
||||||
The following code first defines an event handler for the generic
|
The following code first defines an event handler for the generic event named 'test_event', and then emits an event of that type.
|
||||||
event named 'test_event', and then emits an event of that type.
|
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
function event_test --on-event test_event
|
function event_test --on-event test_event
|
||||||
|
|
|
@ -10,10 +10,10 @@ switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection end-description Description
|
\subsection end-description Description
|
||||||
|
|
||||||
`end` ends a block of commands.
|
`end` ends a block of commands.
|
||||||
|
|
||||||
For more information, read the
|
For more information, read the
|
||||||
documentation for the block constructs, such as \c if, \c for and \c
|
documentation for the block constructs, such as `if`, `for` and `while`.
|
||||||
while.
|
|
||||||
|
|
||||||
The \c end command does not change the current exit status.
|
The `end` command does not change the current exit status.
|
||||||
|
|
|
@ -8,11 +8,10 @@ eval [COMMANDS...]
|
||||||
\subsection eval-description Description
|
\subsection eval-description Description
|
||||||
`eval` evaluates the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator.
|
`eval` evaluates the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator.
|
||||||
|
|
||||||
|
|
||||||
\subsection eval-example Example
|
\subsection eval-example Example
|
||||||
|
|
||||||
The following code will call the ls command. Note that \c fish does not
|
The following code will call the ls command. Note that `fish` does not support the use of shell variables as direct commands; `eval` can be used to work around this.
|
||||||
support the use of shell variables as direct commands; \c eval can
|
|
||||||
be used to work around this.
|
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
set cmd ls
|
set cmd ls
|
||||||
|
|
|
@ -7,11 +7,9 @@ exec COMMAND [OPTIONS...]
|
||||||
|
|
||||||
\subsection exec-description Description
|
\subsection exec-description Description
|
||||||
|
|
||||||
`exec` replaces the currently running shell with a new command.
|
`exec` replaces the currently running shell with a new command. On successful completion, `exec` never returns. `exec` cannot be used inside a pipeline.
|
||||||
On successful completion, `exec` never returns. `exec` cannot be used
|
|
||||||
inside a pipeline.
|
|
||||||
|
|
||||||
\subsection exec-example Example
|
\subsection exec-example Example
|
||||||
|
|
||||||
`exec emacs` starts up the emacs text editor, and exits `fish`.
|
`exec emacs` starts up the emacs text editor, and exits `fish`. When emacs exits, the session will terminate.
|
||||||
When emacs exits, the session will terminate.
|
|
||||||
|
|
|
@ -7,10 +7,6 @@ exit [STATUS]
|
||||||
|
|
||||||
\subsection exit-description Description
|
\subsection exit-description Description
|
||||||
|
|
||||||
`exit` causes fish to exit. If `STATUS` is
|
`exit` causes fish to exit. If `STATUS` is supplied, it will be converted to an integer and used as the exit code. Otherwise, the exit code will be that of the last command executed.
|
||||||
supplied, it will be converted to an integer and used as the exit
|
|
||||||
code. Otherwise, the exit code will be that of the last command executed.
|
|
||||||
|
|
||||||
If exit is called while sourcing a file (using the <a
|
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 itself will not exit.
|
||||||
href="#source">.</a> builtin) the rest of the file will be skipped,
|
|
||||||
but the shell itself will not exit.
|
|
||||||
|
|
|
@ -7,21 +7,37 @@
|
||||||
\endhtmlonly
|
\endhtmlonly
|
||||||
|
|
||||||
- <a href='#faq-envvar'>How do I set or clear an environment variable?</a>
|
- <a href='#faq-envvar'>How do I set or clear an environment variable?</a>
|
||||||
|
|
||||||
- <a href='#faq-login-cmd'>How do I run a command every login? What's fish's equivalent to `.bashrc`?</a>
|
- <a href='#faq-login-cmd'>How do I run a command every login? What's fish's equivalent to `.bashrc`?</a>
|
||||||
|
|
||||||
- <a href='#faq-prompt'>How do I set my prompt?</a>
|
- <a href='#faq-prompt'>How do I set my prompt?</a>
|
||||||
|
|
||||||
- <a href='#faq-cmd-history'>How do I run a command from history?</a>
|
- <a href='#faq-cmd-history'>How do I run a command from history?</a>
|
||||||
|
|
||||||
- <a href='#faq-subcommand'>How do I run a subcommand? The backtick doesn't work!</a>
|
- <a href='#faq-subcommand'>How do I run a subcommand? The backtick doesn't work!</a>
|
||||||
|
|
||||||
- <a href='#faq-exit-status'>How do I get the exit status of a command?</a>
|
- <a href='#faq-exit-status'>How do I get the exit status of a command?</a>
|
||||||
|
|
||||||
- <a href='#faq-single-env'>How do I set an environment variable for just one command?</a>
|
- <a href='#faq-single-env'>How do I set an environment variable for just one command?</a>
|
||||||
|
|
||||||
- <a href='#faq-customize-colors'>How do I customize my syntax highlighting colors?</a>
|
- <a href='#faq-customize-colors'>How do I customize my syntax highlighting colors?</a>
|
||||||
|
|
||||||
- <a href='#faq-update-manpage-completions'>How do I update man page completions?</a>
|
- <a href='#faq-update-manpage-completions'>How do I update man page completions?</a>
|
||||||
|
|
||||||
- <a href='#faq-cwd-symlink'>Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a>
|
- <a href='#faq-cwd-symlink'>Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a>
|
||||||
|
|
||||||
- <a href='#faq-cd-implicit'>I accidentally entered a directory path and fish changed directory. What happened?</a>
|
- <a href='#faq-cd-implicit'>I accidentally entered a directory path and fish changed directory. What happened?</a>
|
||||||
|
|
||||||
- <a href='#faq-open'>The open command doesn't work.</a>
|
- <a href='#faq-open'>The open command doesn't work.</a>
|
||||||
|
|
||||||
- <a href='#faq-default'>How do I make fish my default shell?</a>
|
- <a href='#faq-default'>How do I make fish my default shell?</a>
|
||||||
|
|
||||||
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
|
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
|
||||||
|
|
||||||
- <a href='#faq-greeting'>How do I change the greeting message?</a>
|
- <a href='#faq-greeting'>How do I change the greeting message?</a>
|
||||||
|
|
||||||
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
||||||
|
|
||||||
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
|
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
|
||||||
|
|
||||||
\htmlonly[block]
|
\htmlonly[block]
|
||||||
|
@ -31,6 +47,7 @@
|
||||||
<h1 class="interior_title">Frequently Asked Questions</h1>
|
<h1 class="interior_title">Frequently Asked Questions</h1>
|
||||||
\endhtmlonly
|
\endhtmlonly
|
||||||
|
|
||||||
|
|
||||||
\section faq-envvar How do I set or clear an environment variable?
|
\section faq-envvar How do I set or clear an environment variable?
|
||||||
|
|
||||||
Use the <a href="commands.html#set">`set`</a> command:
|
Use the <a href="commands.html#set">`set`</a> command:
|
||||||
|
@ -40,12 +57,11 @@ set -x key value
|
||||||
set -e key
|
set -e key
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-login-cmd How do I run a command every login? What's fish's equivalent to .bashrc?
|
\section faq-login-cmd How do I run a command every login? What's fish's equivalent to .bashrc?
|
||||||
|
|
||||||
Edit the file `~/.config/fish/config.fish`, creating it if it does not exist. (Note the leading period.)
|
Edit the file `~/.config/fish/config.fish`, creating it if it does not exist (Note the leading period).
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-prompt How do I set my prompt?
|
\section faq-prompt How do I set my prompt?
|
||||||
|
|
||||||
|
@ -62,13 +78,11 @@ end
|
||||||
|
|
||||||
You can also use the Web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, to preview and choose from a gallery of sample prompts.
|
You can also use the Web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, to preview and choose from a gallery of sample prompts.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-cmd-history How do I run a command from history?
|
\section faq-cmd-history How do I run a command from history?
|
||||||
|
|
||||||
Type some part of the command, and then hit the up or down arrow keys to navigate through history matches.
|
Type some part of the command, and then hit the up or down arrow keys to navigate through history matches.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-subcommand How do I run a subcommand? The backtick doesn't work!
|
\section faq-subcommand How do I run a subcommand? The backtick doesn't work!
|
||||||
|
|
||||||
|
@ -80,13 +94,11 @@ for i in (ls)
|
||||||
end
|
end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-exit-status How do I get the exit status of a command?
|
\section faq-exit-status How do I get the exit status of a command?
|
||||||
|
|
||||||
Use the `$status` variable. This replaces the `$?` variable used in some other shells.
|
Use the `$status` variable. This replaces the `$?` variable used in some other shells.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-single-env How do I set an environment variable for just one command?
|
\section faq-single-env How do I set an environment variable for just one command?
|
||||||
|
|
||||||
|
@ -105,18 +117,16 @@ begin
|
||||||
end
|
end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-customize-colors How do I customize my syntax highlighting colors?
|
\section faq-customize-colors How do I customize my syntax highlighting colors?
|
||||||
|
|
||||||
Use the web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, or alter the <a href="index.html#variables-color">`fish_color` family of environment variables</a>.
|
Use the web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, or alter the <a href="index.html#variables-color">`fish_color` family of environment variables</a>.
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-update-manpage-completions How do I update man page completions?
|
\section faq-update-manpage-completions How do I update man page completions?
|
||||||
|
|
||||||
Use the <a href="commands.html#fish_update_completions">`fish_update_completions`</a> command.
|
Use the <a href="commands.html#fish_update_completions">`fish_update_completions`</a> command.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-cwd-symlink Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?
|
\section faq-cwd-symlink Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?
|
||||||
|
|
||||||
|
@ -128,18 +138,16 @@ Writing `cd images; ls ..` given the above directory structure would list the co
|
||||||
|
|
||||||
Another related issue is that many programs that operate on recursive directory trees, like the find command, silently ignore symlinked directories. For example, ```find $PWD -name '*.txt'``` silently fails in shells that don't resolve symlinked paths.
|
Another related issue is that many programs that operate on recursive directory trees, like the find command, silently ignore symlinked directories. For example, ```find $PWD -name '*.txt'``` silently fails in shells that don't resolve symlinked paths.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-cd-implicit I accidentally entered a directory path and fish changed directory. What happened?
|
\section faq-cd-implicit I accidentally entered a directory path and fish changed directory. What happened?
|
||||||
|
|
||||||
If fish is unable to locate a command with a given name, and it starts with '`.`', '`/`' or '`~`', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press `~` and enter.
|
If fish is unable to locate a command with a given name, and it starts with '`.`', '`/`' or '`~`', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press `~` and enter.
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-open The open command doesn't work.
|
\section faq-open The open command doesn't work.
|
||||||
|
|
||||||
The `open` command uses the MIME type database and the `.desktop` files used by Gnome and KDE to identify filetypes and default actions. If at least one of these environments is installed, but the open command is not working, this probably means that the relevant files are installed in a non-standard location. Consider <a href="index.html#more-help">asking for more help</a>.
|
The `open` command uses the MIME type database and the `.desktop` files used by Gnome and KDE to identify filetypes and default actions. If at least one of these environments is installed, but the open command is not working, this probably means that the relevant files are installed in a non-standard location. Consider <a href="index.html#more-help">asking for more help</a>.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-default How do I make fish my default shell?
|
\section faq-default How do I make fish my default shell?
|
||||||
|
|
||||||
|
@ -161,7 +169,6 @@ You may need to adjust the above path to e.g. `/usr/bin/fish`. Use the command `
|
||||||
|
|
||||||
Unfortunately, there is no way to make the changes take effect at once. You will need to log out and back in again.
|
Unfortunately, there is no way to make the changes take effect at once. You will need to log out and back in again.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-titlebar I'm seeing weird output before each prompt when using screen. What's wrong?
|
\section faq-titlebar I'm seeing weird output before each prompt when using screen. What's wrong?
|
||||||
|
|
||||||
|
@ -181,7 +188,6 @@ Fish is trying to set the titlebar message of your terminal. While screen itself
|
||||||
|
|
||||||
Note that fish has a default titlebar message, which will be used if the fish_title function is undefined. So simply unsetting the fish_title function will not work.
|
Note that fish has a default titlebar message, which will be used if the fish_title function is undefined. So simply unsetting the fish_title function will not work.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-greeting How do I change the greeting message?
|
\section faq-greeting How do I change the greeting message?
|
||||||
|
|
||||||
|
@ -191,7 +197,6 @@ Change the value of the variable `fish_greeting` or create a `fish_greeting` fun
|
||||||
set fish_greeting
|
set fish_greeting
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
||||||
|
|
||||||
|
@ -200,14 +205,17 @@ Because history substitution is an awkward interface that was invented before in
|
||||||
Fish history recall is very simple yet effective:
|
Fish history recall is very simple yet effective:
|
||||||
|
|
||||||
- As in any modern shell, the Up arrow, @cursor_key{↑,Up} recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
- As in any modern shell, the Up arrow, @cursor_key{↑,Up} recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
||||||
|
|
||||||
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
||||||
|
|
||||||
- @key{Alt,↑,Up} recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
- @key{Alt,↑,Up} recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
||||||
|
|
||||||
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press @key{Alt,↑,Up}. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press @key{Alt,↑,Up}. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
||||||
|
|
||||||
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (@key{Alt,D} and @key{Alt,Backspace} are your friends).
|
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (@key{Alt,D} and @key{Alt,Backspace} are your friends).
|
||||||
|
|
||||||
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
|
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-uninstalling Uninstalling fish
|
\section faq-uninstalling Uninstalling fish
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@ fg [PID]
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection fg-description Description
|
\subsection fg-description Description
|
||||||
`fg` brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is
|
|
||||||
executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
`fg` brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
||||||
|
|
||||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
||||||
|
|
||||||
|
|
||||||
\subsection fg-example Example
|
\subsection fg-example Example
|
||||||
|
|
||||||
`fg %1` will put the job with job ID 1 in the foreground.
|
`fg %1` will put the job with job ID 1 in the foreground.
|
||||||
|
|
|
@ -7,21 +7,24 @@ fish [OPTIONS] [-c command] [FILE [ARGUMENTS...]]
|
||||||
|
|
||||||
\subsection fish-description Description
|
\subsection fish-description Description
|
||||||
|
|
||||||
`fish` is a command-line shell written mainly with interactive use in mind. The
|
`fish` is a command-line shell written mainly with interactive use in mind. The full manual is available <a href='index.html'>in HTML</a> by using the <a href='#help'>help</a> command from inside fish.
|
||||||
full manual is available <a href='index.html'>in HTML</a> by using the
|
|
||||||
<a href='#help'>help</a> command from inside fish.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-c` or `--command=COMMANDS` evaluate the specified commands instead of reading from the commandline
|
- `-c` or `--command=COMMANDS` evaluate the specified commands instead of reading from the commandline
|
||||||
|
|
||||||
- `-d` or `--debug-level=DEBUG_LEVEL` specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
- `-d` or `--debug-level=DEBUG_LEVEL` specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||||
|
|
||||||
- `-h` or `--help` display help and exit
|
- `-h` or `--help` display help and exit
|
||||||
|
|
||||||
- `-i` or `--interactive` specify that fish is to run in interactive mode
|
- `-i` or `--interactive` specify that fish is to run in interactive mode
|
||||||
|
|
||||||
- `-l` or `--login` specify that fish is to run as a login shell
|
- `-l` or `--login` specify that fish is to run as a login shell
|
||||||
|
|
||||||
- `-n` or `--no-execute` do not execute any commands, only perform syntax checking
|
- `-n` or `--no-execute` do not execute any commands, only perform syntax checking
|
||||||
|
|
||||||
- `-p` or `--profile=PROFILE_FILE` when fish exits, output timing information on all executed commands to the specified file
|
- `-p` or `--profile=PROFILE_FILE` when fish exits, output timing information on all executed commands to the specified file
|
||||||
|
|
||||||
- `-v` or `--version` display version and exit
|
- `-v` or `--version` display version and exit
|
||||||
|
|
||||||
The fish exit status is generally the exit status of the last
|
The fish exit status is generally the exit status of the last foreground command. If fish is exiting because of a parse error, the exit status is 127.
|
||||||
foreground command. If fish is exiting because of a parse error, the
|
|
||||||
exit status is 127.
|
|
||||||
|
|
|
@ -4,19 +4,15 @@
|
||||||
|
|
||||||
`fish_config` starts the web-based configuration interface.
|
`fish_config` starts the web-based configuration interface.
|
||||||
|
|
||||||
The web interface allows you to view your functions, variables and history, and
|
The web interface allows you to view your functions, variables and history, and to make changes to your prompt and color configuration.
|
||||||
to make changes to your prompt and color configuration.
|
|
||||||
|
|
||||||
`fish_config` starts a local web server and then opens a web browser window; when
|
`fish_config` starts a local web server and then opens a web browser window; when you have finished, close the browser window and then press the Enter key to terminate the configuration session.
|
||||||
you have finished, close the browser window and then press the Enter key to
|
|
||||||
terminate the configuration session.
|
|
||||||
|
|
||||||
`fish_config` optionally accepts name of the initial configuration tab. For e.g. `fish_config history` will start configuration interface with history tab.
|
`fish_config` optionally accepts name of the initial configuration tab. For e.g. `fish_config history` will start configuration interface with history tab.
|
||||||
|
|
||||||
If the `BROWSER` environment variable is set, it will be used as the name
|
If the `BROWSER` environment variable is set, it will be used as the name of the web browser to open instead of the system default.
|
||||||
of the web browser to open instead of the system default.
|
|
||||||
|
|
||||||
\subsection fish_config-example Example
|
\subsection fish_config-example Example
|
||||||
|
|
||||||
`fish_config` opens a new web browser window and allows you to configure certain
|
`fish_config` opens a new web browser window and allows you to configure certain fish settings.
|
||||||
fish settings.
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ fish_indent [OPTIONS]
|
||||||
|
|
||||||
\subsection fish_indent-description Description
|
\subsection fish_indent-description Description
|
||||||
|
|
||||||
`fish_indent` is used to indent a piece of fish
|
`fish_indent` is used to indent a piece of fish code. `fish_indent` reads commands from standard input and outputs them to standard output.
|
||||||
code. `fish_indent` reads commands from standard input and outputs
|
|
||||||
them to standard output.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-h` or `--help` displays this help message and then exits
|
- `-h` or `--help` displays this help message and then exits
|
||||||
|
|
||||||
- `-i` or `--no-indent` do not indent commands
|
- `-i` or `--no-indent` do not indent commands
|
||||||
|
|
||||||
- `-v` or `--version` displays the current fish version and then exits
|
- `-v` or `--version` displays the current fish version and then exits
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,14 @@ function fish_prompt
|
||||||
end
|
end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
\subsection fish_prompt-description Description
|
\subsection fish_prompt-description Description
|
||||||
|
|
||||||
By defining the `fish_prompt` function, the user can choose a custom
|
By defining the `fish_prompt` function, the user can choose a custom prompt. The `fish_prompt` function is executed when the prompt is to be shown, and the output is used as a prompt.
|
||||||
prompt. The `fish_prompt` function is executed when the prompt is to
|
|
||||||
be shown, and the output is used as a prompt.
|
|
||||||
|
|
||||||
The exit status of commands within `fish_prompt` will not modify the value of <a href="index.html#variables-status">$status</a> outside of the `fish_prompt` function.
|
The exit status of commands within `fish_prompt` will not modify the value of <a href="index.html#variables-status">$status</a> outside of the `fish_prompt` function.
|
||||||
|
|
||||||
`fish` ships with a number of example prompts that can be chosen with the
|
`fish` ships with a number of example prompts that can be chosen with the `fish_config` command.
|
||||||
`fish_config` command.
|
|
||||||
|
|
||||||
\subsection fish_prompt-example Example
|
\subsection fish_prompt-example Example
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,11 @@ end
|
||||||
|
|
||||||
Multiple lines are not supported in `fish_right_prompt`.
|
Multiple lines are not supported in `fish_right_prompt`.
|
||||||
|
|
||||||
|
|
||||||
\subsection fish_right_prompt-example Example
|
\subsection fish_right_prompt-example Example
|
||||||
|
|
||||||
A simple right prompt:
|
A simple right prompt:
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
function fish_right_prompt -d "Write out the right prompt"
|
function fish_right_prompt -d "Write out the right prompt"
|
||||||
date "+%m/%d/%y"
|
date "+%m/%d/%y"
|
||||||
|
|
|
@ -6,12 +6,11 @@ for VARNAME in [VALUES...]; COMMANDS...; end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection for-description Description
|
\subsection for-description Description
|
||||||
`for` is a loop construct. It will perform the commands specified by
|
|
||||||
`COMMANDS` multiple times. On each iteration, the environment variable specified by
|
`for` is a loop construct. It will perform the commands specified by `COMMANDS` multiple times. On each iteration, the environment variable specified by `VARNAME` is assigned a new value from `VALUES`. If `VALUES` is empty, `COMMANDS` will not be executed at all.
|
||||||
`VARNAME` is assigned a new value from `VALUES`. If `VALUES` is empty, `COMMANDS` will
|
|
||||||
not be executed at all.
|
|
||||||
|
|
||||||
\subsection for-example Example
|
\subsection for-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
for i in foo bar baz; echo $i; end
|
for i in foo bar baz; echo $i; end
|
||||||
|
|
||||||
|
@ -20,4 +19,3 @@ foo
|
||||||
bar
|
bar
|
||||||
baz
|
baz
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,12 @@ funced [OPTIONS] NAME
|
||||||
|
|
||||||
\subsection funced-description Description
|
\subsection funced-description Description
|
||||||
|
|
||||||
`funced` provides an interface to edit the definition of the function
|
`funced` provides an interface to edit the definition of the function `NAME`.
|
||||||
`NAME`.
|
|
||||||
|
|
||||||
If the `$EDITOR` environment variable is set, it will be used as the program
|
If the `$EDITOR` environment variable is set, it will be used as the program to edit the function. Otherwise, a built-in editor will be used.
|
||||||
to edit the function. Otherwise, a built-in editor will be used.
|
|
||||||
|
|
||||||
If there is no function called `NAME` a new function will be created with
|
If there is no function called `NAME` a new function will be created with the specified name
|
||||||
the specified name
|
|
||||||
|
|
||||||
- `-e command` or `--editor command` Open the function
|
- `-e command` or `--editor command` Open the function body inside the text editor given by the command (for example, "vi"). The command 'fish' will use the built-in editor.
|
||||||
body inside the text editor given by the command (for example, "vi"). The
|
|
||||||
command 'fish' will use the built-in editor.
|
- `-i` or `--interactive` Open function body in the built-in editor.
|
||||||
- `-i` or `--interactive` Open function body in the
|
|
||||||
built-in editor.
|
|
||||||
|
|
|
@ -7,8 +7,4 @@ funcsave FUNCTION_NAME
|
||||||
|
|
||||||
\subsection funcsave-description Description
|
\subsection funcsave-description Description
|
||||||
|
|
||||||
`funcsave` saves the current definition of a function to
|
`funcsave` saves the current definition of a function to a file in the fish configuration directory. This function will be automatically loaded by current and future fish sessions. This can be useful if you have interactively created a new function and wish to save it for later use.
|
||||||
a file in the fish configuration directory. This function will be automatically
|
|
||||||
loaded by current and future fish sessions. This can be useful if you have interactively
|
|
||||||
created a new function and wish to save it for later use.
|
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@ function [OPTIONS] NAME; BODY; end
|
||||||
|
|
||||||
`function` creates a new function `NAME` with the body `BODY`.
|
`function` creates a new function `NAME` with the body `BODY`.
|
||||||
|
|
||||||
A function is a list of commands that will be executed when the name of the
|
A function is a list of commands that will be executed when the name of the function is given as a command.
|
||||||
function is given as a command.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
|
@ -24,16 +23,15 @@ The following options are available:
|
||||||
- \c -S or \c --no-scope-shadowing allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
|
- \c -S or \c --no-scope-shadowing allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
|
||||||
- <code>-v</code> or <code>--on-variable VARIABLE_NAME</code> tells fish to run this function when the variable VARIABLE_NAME changes value.
|
- <code>-v</code> or <code>--on-variable VARIABLE_NAME</code> tells fish to run this function when the variable VARIABLE_NAME changes value.
|
||||||
|
|
||||||
If the user enters any additional arguments after the function, they
|
If the user enters any additional arguments after the function, they are inserted into the environment <a href="index.html#variables-arrays">variable array</a> `$argv`. If the `--argument-names` option is provided, the arguments are also assigned to names specified in that option.
|
||||||
are inserted into the environment <a href="index.html#variables-arrays">variable array</a>
|
|
||||||
`$argv`. If the `--argument-names` option is provided, the arguments are
|
|
||||||
also assigned to names specified in that option.
|
|
||||||
|
|
||||||
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href="#emit">emit</a> builtin. Fish generates the following named events:
|
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href="#emit">emit</a> builtin. Fish generates the following named events:
|
||||||
|
|
||||||
- `fish_prompt`, which is emitted whenever a new fish prompt is about to be displayed.
|
- `fish_prompt`, which is emitted whenever a new fish prompt is about to be displayed.
|
||||||
|
|
||||||
- `fish_command_not_found`, which is emitted whenever a command lookup failed.
|
- `fish_command_not_found`, which is emitted whenever a command lookup failed.
|
||||||
|
|
||||||
|
|
||||||
\subsection function-example Example
|
\subsection function-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
|
|
|
@ -15,39 +15,36 @@ functions [-eq] FUNCTIONS...
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-a` or `--all` lists all functions, even those whose name start with an underscore.
|
- `-a` or `--all` lists all functions, even those whose name start with an underscore.
|
||||||
|
|
||||||
- `-c OLDNAME NEWNAME` or `--copy OLDNAME NEWNAME` creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
- `-c OLDNAME NEWNAME` or `--copy OLDNAME NEWNAME` creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
||||||
|
|
||||||
- `-d DESCRIPTION` or `--description=DESCRIPTION` changes the description of this function.
|
- `-d DESCRIPTION` or `--description=DESCRIPTION` changes the description of this function.
|
||||||
|
|
||||||
- `-e` or `--erase` causes the specified functions to be erased.
|
- `-e` or `--erase` causes the specified functions to be erased.
|
||||||
|
|
||||||
- `-h` or `--help` displays a help message and exits.
|
- `-h` or `--help` displays a help message and exits.
|
||||||
|
|
||||||
- `-n` or `--names` lists the names of all defined functions.
|
- `-n` or `--names` lists the names of all defined functions.
|
||||||
|
|
||||||
- `-q` or `--query` tests if the specified functions exist.
|
- `-q` or `--query` tests if the specified functions exist.
|
||||||
|
|
||||||
The default behavior of `functions`, when called with no arguments,
|
The default behavior of `functions`, when called with no arguments, is to print the names of all defined functions. Unless the `-a` option is given, no functions starting with underscores are not included in the output.
|
||||||
is to print the names of all defined functions. Unless the `-a` option is
|
|
||||||
given, no functions starting with underscores are not included in the output.
|
|
||||||
|
|
||||||
If any non-option parameters are given, the definition of the specified
|
If any non-option parameters are given, the definition of the specified functions are printed.
|
||||||
functions are printed.
|
|
||||||
|
|
||||||
Automatically loaded functions cannot be removed using `functions
|
Automatically loaded functions cannot be removed using `functions -e`. Either remove the definition file or change the $fish_function_path variable to remove autoloaded functions.
|
||||||
-e`. Either remove the definition file or change the
|
|
||||||
$fish_function_path variable to remove autoloaded functions.
|
|
||||||
|
|
||||||
Copying a function using `-c` copies only the body of the function, and
|
Copying a function using `-c` copies only the body of the function, and does not attach any event notifications from the original function.
|
||||||
does not attach any event notifications from the original function.
|
|
||||||
|
|
||||||
Only one function's description can be changed in a single invocation
|
Only one function's description can be changed in a single invocation of `functions -d`.
|
||||||
of `functions -d`.
|
|
||||||
|
The exit status of `functions` is the number of functions specified in the argument list that do not exist, which can be used in concert with the `-q` option.
|
||||||
|
|
||||||
The exit status of `functions` is the number of functions
|
|
||||||
specified in the argument list that do not exist, which can be used in
|
|
||||||
concert with the `-q` option.
|
|
||||||
|
|
||||||
\subsection functions-example Examples
|
\subsection functions-example Examples
|
||||||
|
|
||||||
`functions -n` displays a list of currently-defined functions.
|
`functions -n` displays a list of currently-defined functions.
|
||||||
|
|
||||||
`functions -c foo bar` copies the `foo` function to a new function called
|
`functions -c foo bar` copies the `foo` function to a new function called `bar`.
|
||||||
`bar`.
|
|
||||||
|
|
||||||
`functions -e bar` erases the function `bar`.
|
`functions -e bar` erases the function `bar`.
|
||||||
|
|
|
@ -11,11 +11,10 @@ help [SECTION]
|
||||||
|
|
||||||
If a `SECTION` is specified, the help for that command is shown.
|
If a `SECTION` is specified, the help for that command is shown.
|
||||||
|
|
||||||
If the BROWSER environment variable is set, it will be used to display the
|
If the BROWSER environment variable is set, it will be used to display the documentation. Otherwise, fish will search for a suitable browser.
|
||||||
documentation. Otherwise, fish will search for a suitable browser.
|
|
||||||
|
Note that most builtin commands display their help in the terminal when given the `--help` option.
|
||||||
|
|
||||||
Note that most builtin commands display their help in the terminal when
|
|
||||||
given the `--help` option.
|
|
||||||
|
|
||||||
\subsection help-example Example
|
\subsection help-example Example
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,16 @@ prompt will be given. If `--delete` is specified with either of these
|
||||||
parameters, an interactive prompt will be displayed before any items are
|
parameters, an interactive prompt will be displayed before any items are
|
||||||
deleted.
|
deleted.
|
||||||
|
|
||||||
|
|
||||||
\subsection history-examples Example
|
\subsection history-examples Example
|
||||||
|
|
||||||
`history --clear` deletes all history items
|
\fish
|
||||||
|
history --clear
|
||||||
|
# Deletes all history items
|
||||||
|
|
||||||
`history --search --contains "foo"` outputs a list of all previous
|
history --search --contains "foo"
|
||||||
commands containing the string "foo".
|
# Outputs a list of all previous commands containing the string "foo".
|
||||||
|
|
||||||
`history --delete --prefix "foo"` interactively deletes the record
|
history --delete --prefix "foo"
|
||||||
of previous commands which start with "foo".
|
# Interactively deletes the record of previous commands which start with "foo".
|
||||||
|
\endfish
|
||||||
|
|
|
@ -10,22 +10,17 @@ end
|
||||||
|
|
||||||
\subsection if-description Description
|
\subsection if-description Description
|
||||||
|
|
||||||
`if` will execute the command `CONDITION`. If the condition's
|
`if` will execute the command `CONDITION`. If the condition's exit status is 0, the commands `COMMANDS_TRUE` will execute. If the exit status is not 0 and `else` is given, `COMMANDS_FALSE` will be executed.
|
||||||
exit status is 0, the commands `COMMANDS_TRUE` will execute. If the
|
|
||||||
exit status is not 0 and `else` is given, `COMMANDS_FALSE` will
|
|
||||||
be executed.
|
|
||||||
|
|
||||||
In order to use the exit status of multiple commands as the condition
|
In order to use the exit status of multiple commands as the condition of an if block, use <a href="#begin">`begin; ...; end`</a> and the short circuit commands <a href="commands.html#and">`and`</a> and <a href="commands.html#or">`or`</a>.
|
||||||
of an if block, use <a href="#begin">`begin; ...; end`</a> and
|
|
||||||
the short circuit commands <a href="commands.html#and">`and`</a>
|
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||||
and <a href="commands.html#or">`or`</a>.
|
|
||||||
|
|
||||||
The exit status of the last foreground command to exit can always be
|
|
||||||
accessed using the <a href="index.html#variables-status">$status</a>
|
|
||||||
variable.
|
|
||||||
|
|
||||||
\subsection if-example Example
|
\subsection if-example Example
|
||||||
|
|
||||||
|
The following code will print `foo.txt exists` if the file foo.txt exists and is a regular file, otherwise it will print `bar.txt exists` if the file bar.txt exists and is a regular file, otherwise it will print `foo.txt and bar.txt do not exist`.
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
if test -f foo.txt
|
if test -f foo.txt
|
||||||
echo foo.txt exists
|
echo foo.txt exists
|
||||||
|
@ -35,9 +30,3 @@ else
|
||||||
echo foo.txt and bar.txt do not exist
|
echo foo.txt and bar.txt do not exist
|
||||||
end
|
end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
will print `foo.txt exists` if the file foo.txt
|
|
||||||
exists and is a regular file, otherwise it will print
|
|
||||||
`bar.txt exists` if the file bar.txt exists
|
|
||||||
and is a regular file, otherwise it will print
|
|
||||||
`foo.txt and bar.txt do not exist`.
|
|
||||||
|
|
|
@ -42,11 +42,17 @@ Every program on your computer can be used as a command in `fish`. If the progra
|
||||||
Here is a list of some useful commands:
|
Here is a list of some useful commands:
|
||||||
|
|
||||||
- `cd`, change the current directory
|
- `cd`, change the current directory
|
||||||
|
|
||||||
- `ls`, list files and directories
|
- `ls`, list files and directories
|
||||||
|
|
||||||
- `man`, display a manual page on the screen
|
- `man`, display a manual page on the screen
|
||||||
|
|
||||||
- `mv`, move (rename) files
|
- `mv`, move (rename) files
|
||||||
|
|
||||||
- `cp`, copy files
|
- `cp`, copy files
|
||||||
|
|
||||||
- `open`, open files with the default application associated with each filetype
|
- `open`, open files with the default application associated with each filetype
|
||||||
|
|
||||||
- `less`, list the contents of files
|
- `less`, list the contents of files
|
||||||
|
|
||||||
Commands and parameters are separated by the space character ' '. Every command ends with either a newline (i.e. by pressing the return key) or a semicolon '`;`'. More than one command can be written on the same line by separating them with semicolons.
|
Commands and parameters are separated by the space character ' '. Every command ends with either a newline (i.e. by pressing the return key) or a semicolon '`;`'. More than one command can be written on the same line by separating them with semicolons.
|
||||||
|
@ -80,40 +86,76 @@ would remove the two files 'cumbersome' and 'filename.txt'.
|
||||||
Some characters can not be written directly on the command line. For these characters, so called escape sequences are provided. These are:
|
Some characters can not be written directly on the command line. For these characters, so called escape sequences are provided. These are:
|
||||||
|
|
||||||
- '<code>\\a</code>' escapes the alert character
|
- '<code>\\a</code>' escapes the alert character
|
||||||
|
|
||||||
- '<code>\\b</code>' escapes the backspace character
|
- '<code>\\b</code>' escapes the backspace character
|
||||||
|
|
||||||
- '<code>\\e</code>' escapes the escape character
|
- '<code>\\e</code>' escapes the escape character
|
||||||
|
|
||||||
- '<code>\\f</code>' escapes the form feed character
|
- '<code>\\f</code>' escapes the form feed character
|
||||||
|
|
||||||
- '<code>\\n</code>' escapes a newline character
|
- '<code>\\n</code>' escapes a newline character
|
||||||
|
|
||||||
- '<code>\\r</code>' escapes the carriage return character
|
- '<code>\\r</code>' escapes the carriage return character
|
||||||
|
|
||||||
- '<code>\\t</code>' escapes the tab character
|
- '<code>\\t</code>' escapes the tab character
|
||||||
|
|
||||||
- '<code>\\v</code>' escapes the vertical tab character
|
- '<code>\\v</code>' escapes the vertical tab character
|
||||||
|
|
||||||
- '<code>\\ </code>' escapes the space character
|
- '<code>\\ </code>' escapes the space character
|
||||||
|
|
||||||
- '<code>\\$</code>' escapes the dollar character
|
- '<code>\\$</code>' escapes the dollar character
|
||||||
|
|
||||||
- '<code>\\\\</code>' escapes the backslash character
|
- '<code>\\\\</code>' escapes the backslash character
|
||||||
|
|
||||||
- '<code>\\*</code>' escapes the star character
|
- '<code>\\*</code>' escapes the star character
|
||||||
|
|
||||||
- '<code>\\?</code>' escapes the question mark character
|
- '<code>\\?</code>' escapes the question mark character
|
||||||
|
|
||||||
- '<code>\\~</code>' escapes the tilde character
|
- '<code>\\~</code>' escapes the tilde character
|
||||||
|
|
||||||
- '<code>\\%</code>' escapes the percent character
|
- '<code>\\%</code>' escapes the percent character
|
||||||
|
|
||||||
- '<code>\\#</code>' escapes the hash character
|
- '<code>\\#</code>' escapes the hash character
|
||||||
|
|
||||||
- '<code>\\(</code>' escapes the left parenthesis character
|
- '<code>\\(</code>' escapes the left parenthesis character
|
||||||
|
|
||||||
- '<code>\\)</code>' escapes the right parenthesis character
|
- '<code>\\)</code>' escapes the right parenthesis character
|
||||||
|
|
||||||
- '<code>\\{</code>' escapes the left curly bracket character
|
- '<code>\\{</code>' escapes the left curly bracket character
|
||||||
|
|
||||||
- '<code>\\}</code>' escapes the right curly bracket character
|
- '<code>\\}</code>' escapes the right curly bracket character
|
||||||
|
|
||||||
- '<code>\\[</code>' escapes the left bracket character
|
- '<code>\\[</code>' escapes the left bracket character
|
||||||
|
|
||||||
- '<code>\\]</code>' escapes the right bracket character
|
- '<code>\\]</code>' escapes the right bracket character
|
||||||
|
|
||||||
- '<code>\\</code>' escapes the less than character
|
- '<code>\\</code>' escapes the less than character
|
||||||
|
|
||||||
- '<code>\\\></code>' escapes the more than character
|
- '<code>\\\></code>' escapes the more than character
|
||||||
|
|
||||||
- '<code>\\^</code>' escapes the circumflex character
|
- '<code>\\^</code>' escapes the circumflex character
|
||||||
|
|
||||||
- '<code>\\&</code>' escapes the ampersand character
|
- '<code>\\&</code>' escapes the ampersand character
|
||||||
|
|
||||||
- '<code>\\;</code>' escapes the semicolon character
|
- '<code>\\;</code>' escapes the semicolon character
|
||||||
|
|
||||||
- '<code>\\"</code>' escapes the quote character
|
- '<code>\\"</code>' escapes the quote character
|
||||||
|
|
||||||
- '<code>\\'</code>' escapes the apostrophe character
|
- '<code>\\'</code>' escapes the apostrophe character
|
||||||
|
|
||||||
- '<code>\\x<i>xx</i></code>', where <code><i>xx</i></code> is a hexadecimal number, escapes the ascii character with the specified value. For example, `\x9` is the tab character.
|
- '<code>\\x<i>xx</i></code>', where <code><i>xx</i></code> is a hexadecimal number, escapes the ascii character with the specified value. For example, `\x9` is the tab character.
|
||||||
- '<code>\\X<i>xx</i></code>', where <code><i>xx</i></code> is a hexadecimal number, escapes a byte of data with the specified value. If you are using a mutibyte encoding, this can be used to enter invalid strings. Only use this if you know what you are doing.
|
|
||||||
|
- '<code>\\X<i>xx</i></code>', where <code><i>xx</i></code> is a hexadecimal number, escapes a byte of data with the specified value. If you are using a mutibyte encoding, this can be used to enter
|
||||||
|
invalid strings. Only use this if you know what you are doing.
|
||||||
|
|
||||||
- '<code>\\<i>ooo</i></code>', where <code><i>ooo</i></code> is an octal number, escapes the ascii character with the specified value. For example, `\011` is the tab character.
|
- '<code>\\<i>ooo</i></code>', where <code><i>ooo</i></code> is an octal number, escapes the ascii character with the specified value. For example, `\011` is the tab character.
|
||||||
|
|
||||||
- '<code>\\u<i>xxxx</i></code>', where <code><i>xxxx</i></code> is a hexadecimal number, escapes the 16-bit Unicode character with the specified value. For example, `\u9` is the tab character.
|
- '<code>\\u<i>xxxx</i></code>', where <code><i>xxxx</i></code> is a hexadecimal number, escapes the 16-bit Unicode character with the specified value. For example, `\u9` is the tab character.
|
||||||
|
|
||||||
- '<code>\\U<i>xxxxxxxx</i></code>', where <code><i>xxxxxxxx</i></code> is a hexadecimal number, escapes the 32-bit Unicode character with the specified value. For example, `\U9` is the tab character.
|
- '<code>\\U<i>xxxxxxxx</i></code>', where <code><i>xxxxxxxx</i></code> is a hexadecimal number, escapes the 32-bit Unicode character with the specified value. For example, `\U9` is the tab character.
|
||||||
- '<code>\\c<i>x</i></code>', where <code><i>x</i></code> is a letter of the alphabet, escapes the control sequence generated by pressing the control key and the specified letter. For example, `\ci` is the tab character
|
|
||||||
|
- '<code>\\c<i>x</i></code>', where <code><i>x</i></code> is a letter of the alphabet, escapes the control sequence generated by pressing the control key and the specified letter. For example, `\ci` is
|
||||||
|
the tab character
|
||||||
|
|
||||||
|
|
||||||
\subsection redirects Input/Output (IO) redirection
|
\subsection redirects Input/Output (IO) redirection
|
||||||
|
@ -121,7 +163,9 @@ Some characters can not be written directly on the command line. For these chara
|
||||||
Most programs use three input/output (IO) streams, each represented by a number called a file descriptor (FD). These are:
|
Most programs use three input/output (IO) streams, each represented by a number called a file descriptor (FD). These are:
|
||||||
|
|
||||||
- Standard input, FD 0, for reading, defaults to reading from the keyboard.
|
- Standard input, FD 0, for reading, defaults to reading from the keyboard.
|
||||||
|
|
||||||
- Standard output, FD 1, for writing, defaults to writing to the screen.
|
- Standard output, FD 1, for writing, defaults to writing to the screen.
|
||||||
|
|
||||||
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
|
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
|
||||||
|
|
||||||
The reason for providing for two output file descriptors is to allow
|
The reason for providing for two output file descriptors is to allow
|
||||||
|
@ -232,6 +276,7 @@ end
|
||||||
There are a few important things that need to be noted about aliases:
|
There are a few important things that need to be noted about aliases:
|
||||||
|
|
||||||
- Always take care to add the `$argv` variable to the list of parameters to the wrapped command. This makes sure that if the user specifies any additional parameters to the function, they are passed on to the underlying command.
|
- Always take care to add the `$argv` variable to the list of parameters to the wrapped command. This makes sure that if the user specifies any additional parameters to the function, they are passed on to the underlying command.
|
||||||
|
|
||||||
- If the alias has the same name as the aliased command, it is necessary to refix the call to the program with `command` in order to tell fish that the unction should not call itself, but rather a command with the same name. ailing to do so will cause infinite recursion bugs.
|
- If the alias has the same name as the aliased command, it is necessary to refix the call to the program with `command` in order to tell fish that the unction should not call itself, but rather a command with the same name. ailing to do so will cause infinite recursion bugs.
|
||||||
|
|
||||||
To easily create a function of this form, you can use the <a href="commands.html#alias">alias</a> command.
|
To easily create a function of this form, you can use the <a href="commands.html#alias">alias</a> command.
|
||||||
|
@ -262,12 +307,19 @@ The other conditionals use the <a href='#variables-status'>exit status</a> of a
|
||||||
This is a short explanation of some of the commonly used words in fish.
|
This is a short explanation of some of the commonly used words in fish.
|
||||||
|
|
||||||
- <b>argument</b> a parameter given to a command
|
- <b>argument</b> a parameter given to a command
|
||||||
|
|
||||||
- <b>builtin</b> a command that is implemented in the shell. Builtins are commands that are so closely tied to the shell that it is impossible to implement them as external commands.
|
- <b>builtin</b> a command that is implemented in the shell. Builtins are commands that are so closely tied to the shell that it is impossible to implement them as external commands.
|
||||||
|
|
||||||
- <b>command</b> a program that the shell can run.
|
- <b>command</b> a program that the shell can run.
|
||||||
|
|
||||||
- <b>function</b> a block of commands that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
- <b>function</b> a block of commands that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
||||||
|
|
||||||
- <b>job</b> a running pipeline or command
|
- <b>job</b> a running pipeline or command
|
||||||
|
|
||||||
- <b>pipeline</b> a set of commands stringed together so that the output of one command is the input of the next command
|
- <b>pipeline</b> a set of commands stringed together so that the output of one command is the input of the next command
|
||||||
|
|
||||||
- <b>redirection</b> a operation that changes one of the input/output streams associated with a job
|
- <b>redirection</b> a operation that changes one of the input/output streams associated with a job
|
||||||
|
|
||||||
- <b>switch</b> a special flag sent as an argument to a command that will alter the behavior of the command. A switch almost always begins with one or two hyphens.
|
- <b>switch</b> a special flag sent as an argument to a command that will alter the behavior of the command. A switch almost always begins with one or two hyphens.
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,18 +348,27 @@ Tab completion is one of the most time saving features of any modern shell. By t
|
||||||
These are the general purpose tab completions that `fish` provides:
|
These are the general purpose tab completions that `fish` provides:
|
||||||
|
|
||||||
- Completion of commands (builtins, functions and regular programs).
|
- Completion of commands (builtins, functions and regular programs).
|
||||||
|
|
||||||
- Completion of shell variable names.
|
- Completion of shell variable names.
|
||||||
|
|
||||||
- Completion of usernames for tilde expansion.
|
- Completion of usernames for tilde expansion.
|
||||||
|
|
||||||
- Completion of filenames, even on strings with wildcards such as '`*`', '`**`' and '`?`'.
|
- 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>.
|
- Completion of job ID, job name and process names for <a href="#expand-process">process expansion</a>.
|
||||||
|
|
||||||
`fish` provides a large number of program specific completions. Most of these completions are simple options like the `-l` option for `ls`, but some are more advanced. The latter include:
|
`fish` provides a large number of program specific completions. Most of these completions are simple options like the `-l` option for `ls`, but some are more advanced. The latter include:
|
||||||
|
|
||||||
- The programs `man` and `whatis` show all installed manual pages as completions.
|
- The programs `man` and `whatis` show all installed manual pages as completions.
|
||||||
|
|
||||||
- The `make` program uses all targets in the Makefile in the current directory as completions.
|
- The `make` program uses all targets in the Makefile in the current directory as completions.
|
||||||
|
|
||||||
- The `mount` command uses all mount points specified in fstab as completions.
|
- The `mount` command uses all mount points specified in fstab as completions.
|
||||||
|
|
||||||
- The `ssh` command uses all hosts that are stored in the known_hosts file as completions. (See the ssh documentation for more information)
|
- The `ssh` command uses all hosts that are stored in the known_hosts file as completions. (See the ssh documentation for more information)
|
||||||
|
|
||||||
- The `su` command uses all users on the system as completions.
|
- The `su` command uses all users on the system as completions.
|
||||||
|
|
||||||
- The `apt-get`, `rpm` and `yum` commands use all installed packages as completions.
|
- The `apt-get`, `rpm` and `yum` commands use all installed packages as completions.
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,16 +393,24 @@ For examples of how to write your own complex completions, study the completions
|
||||||
|
|
||||||
`fish` ships with several functions that are very useful when writing command specific completions. Most of these functions name begins with the string '`__fish_`'. Such functions are internal to `fish` and their name and interface may change in future fish versions. Still, some of them may be very useful when writing completions. A few of these functions are described here. Be aware that they may be removed or changed in future versions of fish.
|
`fish` ships with several functions that are very useful when writing command specific completions. Most of these functions name begins with the string '`__fish_`'. Such functions are internal to `fish` and their name and interface may change in future fish versions. Still, some of them may be very useful when writing completions. A few of these functions are described here. Be aware that they may be removed or changed in future versions of fish.
|
||||||
|
|
||||||
Functions beginning with the string `__fish_print_` print a newline- separated list of strings. For example, `__fish_print_filesystems` prints a list of all known file systems. Functions beginning with `__fish_complete_` print out a newline separated list of completions with descriptions. The description is separated from the completion by a tab character.
|
Functions beginning with the string `__fish_print_` print a newline separated list of strings. For example, `__fish_print_filesystems` prints a list of all known file systems. Functions beginning with `__fish_complete_` print out a newline separated list of completions with descriptions. The description is separated from the completion by a tab character.
|
||||||
|
|
||||||
- `__fish_complete_directories STRING DESCRIPTION` performs path completion on STRING, allowing only directories, and giving them the description DESCRIPTION.
|
- `__fish_complete_directories STRING DESCRIPTION` performs path completion on STRING, allowing only directories, and giving them the description DESCRIPTION.
|
||||||
|
|
||||||
- `__fish_complete_groups` prints a list of all user groups with the groups members as description.
|
- `__fish_complete_groups` prints a list of all user groups with the groups members as description.
|
||||||
|
|
||||||
- `__fish_complete_pids` prints a list of all processes IDs with the command name as description.
|
- `__fish_complete_pids` prints a list of all processes IDs with the command name as description.
|
||||||
|
|
||||||
- `__fish_complete_suffix SUFFIX` performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description.
|
- `__fish_complete_suffix SUFFIX` performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description.
|
||||||
|
|
||||||
- `__fish_complete_users` prints a list of all users with their full name as description.
|
- `__fish_complete_users` prints a list of all users with their full name as description.
|
||||||
|
|
||||||
- `__fish_print_filesystems` prints a list of all known file systems. Currently, this is a static list, and not dependent on what file systems the host operating system actually understands.
|
- `__fish_print_filesystems` prints a list of all known file systems. Currently, this is a static list, and not dependent on what file systems the host operating system actually understands.
|
||||||
|
|
||||||
- `__fish_print_hostnames` prints a list of all known hostnames. This functions searches the fstab for nfs servers, ssh for known hosts and checks the `/etc/hosts` file.
|
- `__fish_print_hostnames` prints a list of all known hostnames. This functions searches the fstab for nfs servers, ssh for known hosts and checks the `/etc/hosts` file.
|
||||||
|
|
||||||
- `__fish_print_interfaces` prints a list of all known network interfaces.
|
- `__fish_print_interfaces` prints a list of all known network interfaces.
|
||||||
|
|
||||||
- `__fish_print_packages` prints a list of all installed packages. This function currently handles Debian, rpm and Gentoo packages.
|
- `__fish_print_packages` prints a list of all installed packages. This function currently handles Debian, rpm and Gentoo packages.
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,7 +433,9 @@ When an argument for a program is given on the commandline, it undergoes the pro
|
||||||
If a star (`*`) or a question mark (`?`) is present in the parameter, `fish` attempts to match the given parameter to any files in such a way that:
|
If a star (`*`) or a question mark (`?`) is present in the parameter, `fish` attempts to match the given parameter to any files in such a way that:
|
||||||
|
|
||||||
- '`?`' can match any single character except '/'.
|
- '`?`' can match any single character except '/'.
|
||||||
|
|
||||||
- '`*`' can match any string of characters not containing '/'. This includes matching an empty string.
|
- '`*`' can match any string of characters not containing '/'. This includes matching an empty string.
|
||||||
|
|
||||||
- '`**`' matches any string of characters. This includes matching an empty string. The string may include the '/' character but does not need to.
|
- '`**`' matches any string of characters. This includes matching an empty string. The string may include the '/' character but does not need to.
|
||||||
|
|
||||||
Wildcard matches are sorted case insensitively. When sorting matches containing numbers, consecutive digits are considered to be one element, so that the strings '1' '5' and '12' would be sorted in the order given.
|
Wildcard matches are sorted case insensitively. When sorting matches containing numbers, consecutive digits are considered to be one element, so that the strings '1' '5' and '12' would be sorted in the order given.
|
||||||
|
@ -374,7 +445,9 @@ File names beginning with a dot are not considered when wildcarding unless a dot
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- `a*` matches any files beginning with an 'a' in the current directory.
|
- `a*` matches any files beginning with an 'a' in the current directory.
|
||||||
|
|
||||||
- `???` matches any file in the current directory whose name is exactly three characters long.
|
- `???` matches any file in the current directory whose name is exactly three characters long.
|
||||||
|
|
||||||
- `**` matches any files and directories in the current directory and all of its subdirectories.
|
- `**` matches any files and directories in the current directory and all of its subdirectories.
|
||||||
|
|
||||||
Note that if no matches are found for a specific wildcard, it will expand into zero arguments, i.e. to nothing. If none of the wildcarded arguments sent to a command result in any matches, the command will not be executed. If this happens when using the shell interactively, a warning will also be printed.
|
Note that if no matches are found for a specific wildcard, it will expand into zero arguments, i.e. to nothing. If none of the wildcarded arguments sent to a command result in any matches, the command will not be executed. If this happens when using the shell interactively, a warning will also be printed.
|
||||||
|
@ -406,6 +479,7 @@ The command <code>begin; set -l IFS; set data (cat data.txt); end</code>
|
||||||
will set the \c data variable to the contents of 'data.txt' without
|
will set the \c data variable to the contents of 'data.txt' without
|
||||||
splitting it into an array.
|
splitting it into an array.
|
||||||
|
|
||||||
|
|
||||||
\subsection expand-brace Brace expansion
|
\subsection expand-brace Brace expansion
|
||||||
|
|
||||||
A comma separated list of characters enclosed in curly braces will be expanded so each element of the list becomes a new parameter.
|
A comma separated list of characters enclosed in curly braces will be expanded so each element of the list becomes a new parameter.
|
||||||
|
@ -419,6 +493,7 @@ mv *.{c,h} src/
|
||||||
# Moves all files with the suffix '.c' or '.h' to the subdirectory src.
|
# Moves all files with the suffix '.c' or '.h' to the subdirectory src.
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
\subsection expand-variable Variable expansion
|
\subsection expand-variable Variable expansion
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
@ -502,6 +577,7 @@ echo $PATH[$n..-1]
|
||||||
|
|
||||||
Note that variables can be used as indices for expansion of variables, but not command substitution.
|
Note that variables can be used as indices for expansion of variables, but not command substitution.
|
||||||
|
|
||||||
|
|
||||||
\subsection expand-home Home directory expansion
|
\subsection expand-home Home directory expansion
|
||||||
|
|
||||||
The `~` (tilde) character at the beginning of a parameter, followed by a username, is expanded into the home directory of the specified user. A lone `~`, or a `~` followed by a slash, is expanded into the home directory of the process owner.
|
The `~` (tilde) character at the beginning of a parameter, followed by a username, is expanded into the home directory of the specified user. A lone `~`, or a `~` followed by a slash, is expanded into the home directory of the process owner.
|
||||||
|
@ -512,9 +588,13 @@ The `~` (tilde) character at the beginning of a parameter, followed by a usernam
|
||||||
The `%` (percent) character at the beginning of a parameter followed by a string is expanded into a process ID (PID). The following expansions are performed:
|
The `%` (percent) character at the beginning of a parameter followed by a string is expanded into a process ID (PID). The following expansions are performed:
|
||||||
|
|
||||||
- If the string is the entire word `self`, the shell's PID is the result.
|
- If the string is the entire word `self`, the shell's PID is the result.
|
||||||
|
|
||||||
- Otherwise, if the string is the ID of a job, the result is the process group ID of the job.
|
- Otherwise, if the string is the ID of a job, the result is the process group ID of the job.
|
||||||
|
|
||||||
- Otherwise, if any child processes match the specified string, their PIDs are the result of the expansion.
|
- Otherwise, if any child processes match the specified string, their PIDs are the result of the expansion.
|
||||||
|
|
||||||
- Otherwise, if any processes owned by the user match the specified string, their PIDs are the result of the expansion.
|
- Otherwise, if any processes owned by the user match the specified string, their PIDs are the result of the expansion.
|
||||||
|
|
||||||
- If none of these matches apply, an error is produced.
|
- If none of these matches apply, an error is produced.
|
||||||
|
|
||||||
This form of expansion is useful for commands like kill and fg, which take process IDs as arguments.
|
This form of expansion is useful for commands like kill and fg, which take process IDs as arguments.
|
||||||
|
@ -533,9 +613,13 @@ All of the above expansions can be combined. If several expansions result in mor
|
||||||
When combining multiple parameter expansions, expansions are performed in the following order:
|
When combining multiple parameter expansions, expansions are performed in the following order:
|
||||||
|
|
||||||
- Command substitutions
|
- Command substitutions
|
||||||
|
|
||||||
- Variable expansions
|
- Variable expansions
|
||||||
|
|
||||||
- Bracket expansion
|
- Bracket expansion
|
||||||
|
|
||||||
- Pid expansion
|
- Pid expansion
|
||||||
|
|
||||||
- Wildcard expansion
|
- Wildcard expansion
|
||||||
|
|
||||||
Expansions are performed from right to left, nested bracket expansions are performed from the inside and out.
|
Expansions are performed from right to left, nested bracket expansions are performed from the inside and out.
|
||||||
|
@ -596,8 +680,8 @@ Universal variables are variables that are shared between all the users fish ses
|
||||||
|
|
||||||
To see universal variables in action, start two fish sessions side by side, and issue the following command in one of them `set fish_color_cwd blue`. Since `fish_color_cwd` is a universal variable, the color of the current working directory listing in the prompt will instantly change to blue on both terminals.
|
To see universal variables in action, start two fish sessions side by side, and issue the following command in one of them `set fish_color_cwd blue`. Since `fish_color_cwd` is a universal variable, the color of the current working directory listing in the prompt will instantly change to blue on both terminals.
|
||||||
|
|
||||||
\subsection variables-functions Variable scope for functions
|
|
||||||
|
|
||||||
|
\subsection variables-functions Variable scope for functions
|
||||||
|
|
||||||
When calling a function, all current local variables temporarily disappear. This shadowing of the local scope is needed since the variable namespace would become cluttered, making it very easy to accidentally overwrite variables from another function.
|
When calling a function, all current local variables temporarily disappear. This shadowing of the local scope is needed since the variable namespace would become cluttered, making it very easy to accidentally overwrite variables from another function.
|
||||||
|
|
||||||
|
@ -701,9 +785,9 @@ values of most of these variables.
|
||||||
- \c USER, the current username. This variable can be changed by the user.
|
- \c USER, the current username. This variable can be changed by the user.
|
||||||
- \c CMD_DURATION, the runtime of the last command in milliseconds.
|
- \c CMD_DURATION, the runtime of the last command in milliseconds.
|
||||||
|
|
||||||
The names of these variables are mostly derived from the csh family of
|
The names of these variables are mostly derived from the csh family of shells and differ from the ones used by Bourne style shells such as bash.
|
||||||
shells and differ from the ones used by Bourne style shells such as
|
|
||||||
bash.
|
Variables whose name are in uppercase are exported to the commands started by fish, while those in lowercase are not exported. This rule is not enforced by fish, but it is good coding practice to use casing to distinguish between exported and unexported variables. `fish` also uses several variables internally. Such variables are prefixed with the string `__FISH` or `__fish`. These should never be used by the user. Changing their value may break fish.
|
||||||
|
|
||||||
Variables whose name are in uppercase are exported to the commands
|
Variables whose name are in uppercase are exported to the commands
|
||||||
started by fish, while those in lowercase are not exported. This rule is not
|
started by fish, while those in lowercase are not exported. This rule is not
|
||||||
|
@ -722,9 +806,13 @@ Fish stores the exit status of the last process in the last job to exit in the `
|
||||||
If `fish` encounters a problem while executing a command, the status variable may also be set to a specific value:
|
If `fish` encounters a problem while executing a command, the status variable may also be set to a specific value:
|
||||||
|
|
||||||
- 1 is the generally the exit status from fish builtin commands if they were supplied with invalid arguments
|
- 1 is the generally the exit status from fish builtin commands if they were supplied with invalid arguments
|
||||||
|
|
||||||
- 124 means that the command was not executed because none of the wildcards in the command produced any matches
|
- 124 means that the command was not executed because none of the wildcards in the command produced any matches
|
||||||
|
|
||||||
- 125 means that while an executable with the specified name was located, the operating system could not actually execute the command
|
- 125 means that while an executable with the specified name was located, the operating system could not actually execute the command
|
||||||
|
|
||||||
- 126 means that while a file with the specified name was located, it was not executable
|
- 126 means that while a file with the specified name was located, it was not executable
|
||||||
|
|
||||||
- 127 means that no function, builtin or command with the given name could be located
|
- 127 means that no function, builtin or command with the given name could be located
|
||||||
|
|
||||||
If a process exits through a signal, the exit status will be 128 plus the number of the signal.
|
If a process exits through a signal, the exit status will be 128 plus the number of the signal.
|
||||||
|
@ -737,26 +825,42 @@ The colors used by fish for syntax highlighting can be configured by changing th
|
||||||
The following variables are available to change the highlighting colors in fish:
|
The following variables are available to change the highlighting colors in fish:
|
||||||
|
|
||||||
- `fish_color_normal`, the default color
|
- `fish_color_normal`, the default color
|
||||||
|
|
||||||
- `fish_color_command`, the color for commands
|
- `fish_color_command`, the color for commands
|
||||||
|
|
||||||
- `fish_color_quote`, the color for quoted blocks of text
|
- `fish_color_quote`, the color for quoted blocks of text
|
||||||
|
|
||||||
- `fish_color_redirection`, the color for IO redirections
|
- `fish_color_redirection`, the color for IO redirections
|
||||||
|
|
||||||
- `fish_color_end`, the color for process separators like ';' and '&'
|
- `fish_color_end`, the color for process separators like ';' and '&'
|
||||||
|
|
||||||
- `fish_color_error`, the color used to highlight potential errors
|
- `fish_color_error`, the color used to highlight potential errors
|
||||||
|
|
||||||
- `fish_color_param`, the color for regular command parameters
|
- `fish_color_param`, the color for regular command parameters
|
||||||
|
|
||||||
- `fish_color_comment`, the color used for code comments
|
- `fish_color_comment`, the color used for code comments
|
||||||
|
|
||||||
- `fish_color_match`, the color used to highlight matching parenthesis
|
- `fish_color_match`, the color used to highlight matching parenthesis
|
||||||
|
|
||||||
- `fish_color_search_match`, the color used to highlight history search matches
|
- `fish_color_search_match`, the color used to highlight history search matches
|
||||||
|
|
||||||
- `fish_color_operator`, the color for parameter expansion operators like '*' and '~'
|
- `fish_color_operator`, the color for parameter expansion operators like '*' and '~'
|
||||||
|
|
||||||
- `fish_color_escape`, the color used to highlight character escapes like '\\n' and '\\x70'
|
- `fish_color_escape`, the color used to highlight character escapes like '\\n' and '\\x70'
|
||||||
|
|
||||||
- `fish_color_cwd`, the color used for the current working directory in the default prompt
|
- `fish_color_cwd`, the color used for the current working directory in the default prompt
|
||||||
|
|
||||||
Additionally, the following variables are available to change the
|
Additionally, the following variables are available to change the
|
||||||
highlighting in the completion pager:
|
highlighting in the completion pager:
|
||||||
|
|
||||||
- `fish_pager_color_prefix`, the color of the prefix string, i.e. the string that is to be completed
|
- `fish_pager_color_prefix`, the color of the prefix string, i.e. the string that is to be completed
|
||||||
|
|
||||||
- `fish_pager_color_completion`, the color of the completion itself
|
- `fish_pager_color_completion`, the color of the completion itself
|
||||||
|
|
||||||
- `fish_pager_color_description`, the color of the completion description
|
- `fish_pager_color_description`, the color of the completion description
|
||||||
|
|
||||||
- `fish_pager_color_progress`, the color of the progress bar at the bottom left corner
|
- `fish_pager_color_progress`, the color of the progress bar at the bottom left corner
|
||||||
|
|
||||||
- `fish_pager_color_secondary`, the background color of the every second completion
|
- `fish_pager_color_secondary`, the background color of the every second completion
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -792,25 +896,45 @@ Similar to bash, fish has Emacs and Vi editing modes. The default editing mode i
|
||||||
\subsection emacs-mode Emacs mode commands
|
\subsection emacs-mode Emacs mode commands
|
||||||
|
|
||||||
- @key{Tab} <a href="#completion">completes</a> the current token.
|
- @key{Tab} <a href="#completion">completes</a> the current token.
|
||||||
|
|
||||||
- @key{Home} or @key{Control,A} moves the cursor to the beginning of the line.
|
- @key{Home} or @key{Control,A} moves the cursor to the beginning of the line.
|
||||||
|
|
||||||
- @key{End} or @key{Control,E} moves to the end of line. If the cursor is already at the end of the line, and an autosuggestion is available, @key{End} or @key{Control,E} accepts the autosuggestion.
|
- @key{End} or @key{Control,E} moves to the end of line. If the cursor is already at the end of the line, and an autosuggestion is available, @key{End} or @key{Control,E} accepts the autosuggestion.
|
||||||
|
|
||||||
- @cursor_key{←,Left} (or @key{Control,B}) and @cursor_key{→,Right} (or @key{Control,F}) move the cursor left or right by one character. If the cursor is already at the end of the line, and an autosuggestion is available, the @cursor_key{→,Right} key and the @key{Control,F} combination accept the suggestion.
|
- @cursor_key{←,Left} (or @key{Control,B}) and @cursor_key{→,Right} (or @key{Control,F}) move the cursor left or right by one character. If the cursor is already at the end of the line, and an autosuggestion is available, the @cursor_key{→,Right} key and the @key{Control,F} combination accept the suggestion.
|
||||||
|
|
||||||
- @key{Alt,←,Left} and @key{Alt,→,Right} move the cursor one word left or right, or moves forward/backward in the directory history if the command line is empty. If the cursor is already at the end of the line, and an autosuggestion is available, @key{Alt,→,Right} (or @key{Alt,F}) accepts the first word in the suggestion.
|
- @key{Alt,←,Left} and @key{Alt,→,Right} move the cursor one word left or right, or moves forward/backward in the directory history if the command line is empty. If the cursor is already at the end of the line, and an autosuggestion is available, @key{Alt,→,Right} (or @key{Alt,F}) accepts the first word in the suggestion.
|
||||||
|
|
||||||
- @cursor_key{↑,Up} and @cursor_key{↓,Down} search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the <a href='#history'>history </a>section for more information on history searching.
|
- @cursor_key{↑,Up} and @cursor_key{↓,Down} search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the <a href='#history'>history </a>section for more information on history searching.
|
||||||
|
|
||||||
- @key{Alt,↑,Up} and @key{Alt,↓,Down} search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the <a href='#history'>history </a>section for more information on history searching.
|
- @key{Alt,↑,Up} and @key{Alt,↓,Down} search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the <a href='#history'>history </a>section for more information on history searching.
|
||||||
|
|
||||||
- @key{Delete} and @key{Backspace} removes one character forwards or backwards respectively.
|
- @key{Delete} and @key{Backspace} removes one character forwards or backwards respectively.
|
||||||
|
|
||||||
- @key{Control,C} deletes the entire line.
|
- @key{Control,C} deletes the entire line.
|
||||||
|
|
||||||
- @key{Control,D} delete one character to the right of the cursor. If the command line is empty, @key{Control,D} will exit fish.
|
- @key{Control,D} delete one character to the right of the cursor. If the command line is empty, @key{Control,D} will exit fish.
|
||||||
|
|
||||||
- @key{Control,K} moves contents from the cursor to the end of line to the <a href="#killring">killring</a>.
|
- @key{Control,K} moves contents from the cursor to the end of line to the <a href="#killring">killring</a>.
|
||||||
|
|
||||||
- @key{Control,U} moves contents from the beginning of line to the cursor to the <a href="#killring">killring</a>.
|
- @key{Control,U} moves contents from the beginning of line to the cursor to the <a href="#killring">killring</a>.
|
||||||
|
|
||||||
- @key{Control,L} clears and repaints the screen.
|
- @key{Control,L} clears and repaints the screen.
|
||||||
|
|
||||||
- @key{Control,W} moves the previous word to the <a href="#killring">killring</a>.
|
- @key{Control,W} moves the previous word to the <a href="#killring">killring</a>.
|
||||||
|
|
||||||
- @key{Alt,D} moves the next word to the <a href="#killring">killring</a>.
|
- @key{Alt,D} moves the next word to the <a href="#killring">killring</a>.
|
||||||
|
|
||||||
- @key{Alt,W} prints a short description of the command under the cursor.
|
- @key{Alt,W} prints a short description of the command under the cursor.
|
||||||
|
|
||||||
- @key{Alt,L} lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed.
|
- @key{Alt,L} lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed.
|
||||||
|
|
||||||
- @key{Alt,P} adds the string '`| less;`' to the end of the job under the cursor. The result is that the output of the command will be paged.
|
- @key{Alt,P} adds the string '`| less;`' to the end of the job under the cursor. The result is that the output of the command will be paged.
|
||||||
|
|
||||||
- @key{Alt,C} capitalizes the current word.
|
- @key{Alt,C} capitalizes the current word.
|
||||||
|
|
||||||
- @key{Alt,U} makes the current word uppercase.
|
- @key{Alt,U} makes the current word uppercase.
|
||||||
|
|
||||||
- @key{F1} shows the manual page for the current command, if one exists.
|
- @key{F1} shows the manual page for the current command, if one exists.
|
||||||
|
|
||||||
You can change these key bindings using the <a href="commands.html#bind">bind</a> builtin command.
|
You can change these key bindings using the <a href="commands.html#bind">bind</a> builtin command.
|
||||||
|
@ -821,15 +945,25 @@ You can change these key bindings using the <a href="commands.html#bind">bind</a
|
||||||
Vi mode allows for the use of Vi-like commands when at the bash prompt. You'll initially be in insert mode. Hitting the escape key takes you into command mode where you can use, but aren't limited to, the following.
|
Vi mode allows for the use of Vi-like commands when at the bash prompt. You'll initially be in insert mode. Hitting the escape key takes you into command mode where you can use, but aren't limited to, the following.
|
||||||
|
|
||||||
- @key{h} moves cursor left
|
- @key{h} moves cursor left
|
||||||
|
|
||||||
- @key{l} moves cursor right
|
- @key{l} moves cursor right
|
||||||
|
|
||||||
- @key{Shift,A} moves cursor to end of line and put in insert mode
|
- @key{Shift,A} moves cursor to end of line and put in insert mode
|
||||||
|
|
||||||
- @key{0} (zero) Move cursor to beginning of line (doesn't put in insert mode)
|
- @key{0} (zero) Move cursor to beginning of line (doesn't put in insert mode)
|
||||||
|
|
||||||
- @key{i} put into insert mode at current position
|
- @key{i} put into insert mode at current position
|
||||||
|
|
||||||
- @key{a} put into insert mode after current position
|
- @key{a} put into insert mode after current position
|
||||||
|
|
||||||
- @key{d}@key{d} Delete line (saved for pasting)
|
- @key{d}@key{d} Delete line (saved for pasting)
|
||||||
|
|
||||||
- @key{Shift,D} delete text after current cursor position (saved for pasting)
|
- @key{Shift,D} delete text after current cursor position (saved for pasting)
|
||||||
|
|
||||||
- @key{p} paste text that was deleted
|
- @key{p} paste text that was deleted
|
||||||
|
|
||||||
- @key{u} undo
|
- @key{u} undo
|
||||||
|
|
||||||
- etc for many of the other Vi commands
|
- etc for many of the other Vi commands
|
||||||
|
|
||||||
|
|
||||||
|
@ -864,7 +998,9 @@ If the commandline reads `cd m`, place the cursor over the `m` character and pre
|
||||||
The fish commandline editor can be used to work on commands that are several lines long. There are three ways to make a command span more than a single line:
|
The fish commandline editor can be used to work on commands that are several lines long. There are three ways to make a command span more than a single line:
|
||||||
|
|
||||||
- Pressing the @key{Enter} key while a block of commands is unclosed, such as when one or more block commands such as `for`, `begin` or `if` do not have a corresponding `end` command.
|
- Pressing the @key{Enter} key while a block of commands is unclosed, such as when one or more block commands such as `for`, `begin` or `if` do not have a corresponding `end` command.
|
||||||
|
|
||||||
- Pressing @key{Alt,Enter} instead of pressing the @key{Enter} key.
|
- Pressing @key{Alt,Enter} instead of pressing the @key{Enter} key.
|
||||||
|
|
||||||
- By inserting a backslash (`\`) character before pressing the @key{Enter} key, escaping the newline.
|
- By inserting a backslash (`\`) character before pressing the @key{Enter} key, escaping the newline.
|
||||||
|
|
||||||
The fish commandline editor works exactly the same in single line mode and in multiline mode. To move between lines use the left and right arrow keys and other such keyboard shortcuts.
|
The fish commandline editor works exactly the same in single line mode and in multiline mode. To move between lines use the left and right arrow keys and other such keyboard shortcuts.
|
||||||
|
@ -921,8 +1057,11 @@ end
|
||||||
Detected errors include:
|
Detected errors include:
|
||||||
|
|
||||||
- Non existing commands.
|
- Non existing commands.
|
||||||
|
|
||||||
- Reading from or appending to a non existing file.
|
- Reading from or appending to a non existing file.
|
||||||
|
|
||||||
- Incorrect use of output redirects
|
- Incorrect use of output redirects
|
||||||
|
|
||||||
- Mismatched parenthesis
|
- Mismatched parenthesis
|
||||||
|
|
||||||
|
|
||||||
|
@ -979,9 +1118,13 @@ If a function named `fish_greeting` exists, it will be run when entering interac
|
||||||
When defining a new function in fish, it is possible to make it into an event handler, i.e. a function that is automatically run when a specific event takes place. Events that can trigger a handler currently are:
|
When defining a new function in fish, it is possible to make it into an event handler, i.e. a function that is automatically run when a specific event takes place. Events that can trigger a handler currently are:
|
||||||
|
|
||||||
- When a signal is delivered
|
- When a signal is delivered
|
||||||
|
|
||||||
- When a process or job exits
|
- When a process or job exits
|
||||||
|
|
||||||
- When the value of a variable is updated
|
- When the value of a variable is updated
|
||||||
|
|
||||||
- When the prompt is about to be shown
|
- When the prompt is about to be shown
|
||||||
|
|
||||||
- When a command lookup fails
|
- When a command lookup fails
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
|
@ -6,12 +6,12 @@ isatty [FILE | DEVICE | FILE DESCRIPTOR NUMBER]
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection isatty-description Description
|
\subsection isatty-description Description
|
||||||
`isatty` tests if a file or file descriptor is a tty.
|
|
||||||
The argument may be in the form of a file path, device, or file descriptor
|
`isatty` tests if a file or file descriptor is a tty. The argument may be in the form of a file path, device, or file descriptor number. Without an argument, `standard input` is implied.
|
||||||
number. Without an argument, `standard input` is implied.
|
|
||||||
|
|
||||||
If the resolved file descriptor is a tty, the command returns zero. Otherwise, the command exits one. No messages are printed to standard error.
|
If the resolved file descriptor is a tty, the command returns zero. Otherwise, the command exits one. No messages are printed to standard error.
|
||||||
|
|
||||||
|
|
||||||
\subsection isatty-examples Examples
|
\subsection isatty-examples Examples
|
||||||
|
|
||||||
From an interactive shell, the commands below exit with a return value of zero:
|
From an interactive shell, the commands below exit with a return value of zero:
|
||||||
|
|
|
@ -6,21 +6,23 @@ jobs [OPTIONS] [PID]
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection jobs-description Description
|
\subsection jobs-description Description
|
||||||
`jobs` prints a list of the currently
|
|
||||||
running <a href="index.html#syntax-job-control">jobs</a> and their status.
|
`jobs` prints a list of the currently running <a href="index.html#syntax-job-control">jobs</a> and their status.
|
||||||
|
|
||||||
jobs accepts the following switches:
|
jobs accepts the following switches:
|
||||||
|
|
||||||
- `-c` or `--command` prints the command name for each process in jobs.
|
- `-c` or `--command` prints the command name for each process in jobs.
|
||||||
|
|
||||||
- `-g` or `--group` only prints the group ID of each job.
|
- `-g` or `--group` only prints the group ID of each job.
|
||||||
|
|
||||||
- `-h` or `--help` displays a help message and exits.
|
- `-h` or `--help` displays a help message and exits.
|
||||||
|
|
||||||
- `-l` or `--last` prints only the last job to be started.
|
- `-l` or `--last` prints only the last job to be started.
|
||||||
|
|
||||||
- `-p` or `--pid` prints the process ID for each process in all jobs.
|
- `-p` or `--pid` prints the process ID for each process in all jobs.
|
||||||
|
|
||||||
On systems that supports this feature, jobs will print the CPU usage
|
On systems that supports this feature, jobs will print the CPU usage of each job since the last command was executed. The CPU usage is expressed as a percentage of full CPU activity. Note that on multiprocessor systems, the total activity may be more than 100\%.
|
||||||
of each job since the last command was executed. The CPU usage is
|
|
||||||
expressed as a percentage of full CPU activity. Note that on
|
|
||||||
multiprocessor systems, the total activity may be more than 100\%.
|
|
||||||
|
|
||||||
\subsection jobs-example Example
|
\subsection jobs-example Example
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
|
|
||||||
\endhtmlonly
|
\endhtmlonly
|
||||||
|
|
||||||
`fish` Copyright © 2005-2009 Axel Liljencrantz. `fish` is released under the GNU
|
`fish` Copyright © 2005-2009 Axel Liljencrantz. `fish` is released under the GNU General Public License, version 2. The license agreement is included below.
|
||||||
General Public License, version 2. The license agreement is included below.
|
|
||||||
|
|
||||||
## <a name="GPL2_SEC1"> GNU GENERAL PUBLIC LICENSE
|
## <a name="GPL2_SEC1"> GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
@ -25,318 +24,126 @@ Version 2, June 1991
|
||||||
## <a name="GPL2_SEC2"> Preamble
|
## <a name="GPL2_SEC2"> Preamble
|
||||||
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your freedom to share
|
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software - to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
|
||||||
and change it. By contrast, the GNU General Public License is intended to
|
|
||||||
guarantee your freedom to share and change free software - to make sure the
|
|
||||||
software is free for all its users. This General Public License applies to
|
|
||||||
most of the Free Software Foundation's software and to any other program whose
|
|
||||||
authors commit to using it. (Some other Free Software Foundation software is
|
|
||||||
covered by the GNU Library General Public License instead.) You can apply it
|
|
||||||
to your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not price. Our
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||||
General Public Licenses are designed to make sure that you have the freedom to
|
|
||||||
distribute copies of free software (and charge for this service if you wish),
|
|
||||||
that you receive source code or can get it if you want it, that you can change
|
|
||||||
the software or use pieces of it in new free programs; and that you know you
|
|
||||||
can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid anyone to
|
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||||
deny you these rights or to ask you to surrender the rights. These
|
|
||||||
restrictions translate to certain responsibilities for you if you distribute
|
|
||||||
copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether gratis or for
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||||
a fee, you must give the recipients all the rights that you have. You must
|
|
||||||
make sure that they, too, receive or can get the source code. And you must
|
|
||||||
show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||||
offer you this license which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain that
|
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||||
everyone understands that there is no warranty for this free software. If the
|
|
||||||
software is modified by someone else and passed on, we want its recipients to
|
|
||||||
know that what they have is not the original, so that any problems introduced
|
|
||||||
by others will not reflect on the original authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software patents. We
|
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||||
wish to avoid the danger that redistributors of a free program will
|
|
||||||
individually obtain patent licenses, in effect making the program proprietary.
|
|
||||||
To prevent this, we have made it clear that any patent must be licensed for
|
|
||||||
everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and modification
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
follow.
|
|
||||||
|
|
||||||
|
|
||||||
## <a name="GPL2_SEC3"> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
## <a name="GPL2_SEC3"> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
- This License applies to any program or other work which contains a notice
|
- This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||||
placed by the copyright holder saying it may be distributed under the terms of
|
|
||||||
this General Public License. The "Program", below, refers to any such program
|
|
||||||
or work, and a "work based on the Program" means either the Program or any
|
|
||||||
derivative work under copyright law: that is to say, a work containing the
|
|
||||||
Program or a portion of it, either verbatim or with modifications and/or
|
|
||||||
translated into another language. (Hereinafter, translation is included
|
|
||||||
without limitation in the term "modification".) Each licensee is addressed as
|
|
||||||
"you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not covered
|
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||||
by this License; they are outside its scope. The act of running the Program
|
|
||||||
is not restricted, and the output from the Program is covered only if its
|
|
||||||
contents constitute a work based on the Program (independent of having been
|
|
||||||
made by running the Program). Whether that is true depends on what the Program
|
|
||||||
does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's source code as
|
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||||
you receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice and
|
|
||||||
disclaimer of warranty; keep intact all the notices that refer to this License
|
|
||||||
and to the absence of any warranty; and give any other recipients of the
|
|
||||||
Program a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and you may
|
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||||
at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion of it,
|
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||||
thus forming a work based on the Program, and copy and distribute such
|
|
||||||
modifications or work under the terms of Section 1 above, provided that you
|
|
||||||
also meet all of these conditions:
|
|
||||||
|
|
||||||
-# You must cause the modified files to carry prominent notices stating
|
-# You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||||
that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
-# You must cause any work that you distribute or publish, that in whole or
|
-# You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||||
in part contains or is derived from the Program or any part thereof, to be
|
|
||||||
licensed as a whole at no charge to all third parties under the terms of this
|
|
||||||
License.
|
|
||||||
|
|
||||||
-# If the modified program normally reads commands interactively when run,
|
-# If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||||
you must cause it, when started running for such interactive use in the most
|
|
||||||
ordinary way, to print or display an announcement including an appropriate
|
|
||||||
copyright notice and a notice that there is no warranty (or else, saying that
|
|
||||||
you provide a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this License.
|
|
||||||
(Exception: if the Program itself is interactive but does not normally print
|
|
||||||
such an announcement, your work based on the Program is not required to print
|
|
||||||
an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If identifiable
|
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
sections of that work are not derived from the Program, and can be reasonably
|
|
||||||
considered independent and separate works in themselves, then this License,
|
|
||||||
and its terms, do not apply to those sections when you distribute them as
|
|
||||||
separate works. But when you distribute the same sections as part of a whole
|
|
||||||
which is a work based on the Program, the distribution of the whole must be on
|
|
||||||
the terms of this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest your
|
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||||
rights to work written entirely by you; rather, the intent is to exercise the
|
|
||||||
right to control the distribution of derivative or collective works based on
|
|
||||||
the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program with
|
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||||
the Program (or with a work based on the Program) on a volume of a storage or
|
|
||||||
distribution medium does not bring the other work under the scope of this
|
|
||||||
License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it, under
|
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||||
Section 2) in object code or executable form under the terms of Sections 1 and
|
|
||||||
2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
-# Accompany it with the complete corresponding machine-readable source code,
|
-# Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
which must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
-# Accompany it with a written offer, valid for at least three years, to give
|
-# Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
any third party, for a charge no more than your cost of physically
|
|
||||||
performing source distribution, a complete machine-readable copy of the
|
|
||||||
corresponding source code, to be distributed under the terms of Sections 1
|
|
||||||
and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
-# Accompany it with the information you received as to the offer to
|
-# Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||||
distribute corresponding source code. (This alternative is allowed only
|
|
||||||
for noncommercial distribution and only if you received the program in
|
|
||||||
object code or executable form with such an offer, in accord with
|
|
||||||
Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for making
|
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||||
modifications to it. For an executable work, complete source code means all
|
|
||||||
the source code for all modules it contains, plus any associated interface
|
|
||||||
definition files, plus the scripts used to control compilation and
|
|
||||||
installation of the executable. However, as a special exception, the source
|
|
||||||
code distributed need not include anything that is normally distributed (in
|
|
||||||
either source or binary form) with the major components (compiler, kernel, and
|
|
||||||
so on) of the operating system on which the executable runs, unless that
|
|
||||||
component itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering access to
|
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||||
copy from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place counts as distribution of the source code,
|
|
||||||
even though third parties are not compelled to copy the source along with the
|
|
||||||
object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program except as
|
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||||
expressly provided under this License. Any attempt otherwise to copy, modify,
|
|
||||||
sublicense or distribute the Program is void, and will automatically terminate
|
|
||||||
your rights under this License. However, parties who have received copies, or
|
|
||||||
rights, from you under this License will not have their licenses terminated so
|
|
||||||
long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not signed it.
|
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||||
However, nothing else grants you permission to modify or distribute the
|
|
||||||
Program or its derivative works. These actions are prohibited by law if you
|
|
||||||
do not accept this License. Therefore, by modifying or distributing the
|
|
||||||
Program (or any work based on the Program), you indicate your acceptance of
|
|
||||||
this License to do so, and all its terms and conditions for copying,
|
|
||||||
distributing or modifying the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the Program),
|
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||||
the recipient automatically receives a license from the original licensor to
|
|
||||||
copy, distribute or modify the Program subject to these terms and conditions.
|
|
||||||
You may not impose any further restrictions on the recipients' exercise of the
|
|
||||||
rights granted herein. You are not responsible for enforcing compliance by
|
|
||||||
third parties to this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or otherwise)
|
|
||||||
that contradict the conditions of this License, they do not excuse you from
|
|
||||||
the conditions of this License. If you cannot distribute so as to satisfy
|
|
||||||
simultaneously your obligations under this License and any other pertinent
|
|
||||||
obligations, then as a consequence you may not distribute the Program at all.
|
|
||||||
For example, if a patent license would not permit royalty-free redistribution
|
|
||||||
of the Program by all those who receive copies directly or indirectly through
|
|
||||||
you, then the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||||
particular circumstance, the balance of the section is intended to apply and
|
|
||||||
the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any patents or
|
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||||
other property right claims or to contest validity of any such claims; this
|
|
||||||
section has the sole purpose of protecting the integrity of the free software
|
|
||||||
distribution system, which is implemented by public license practices. Many
|
|
||||||
people have made generous contributions to the wide range of software
|
|
||||||
distributed through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing to
|
|
||||||
distribute software through any other system and a licensee cannot impose that
|
|
||||||
choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to be a
|
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||||
consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in certain
|
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||||
countries either by patents or by copyrighted interfaces, the original
|
|
||||||
copyright holder who places the Program under this License may add an explicit
|
|
||||||
geographical distribution limitation excluding those countries, so that
|
|
||||||
distribution is permitted only in or among countries not thus excluded. In
|
|
||||||
such case, this License incorporates the limitation as if written in the body
|
|
||||||
of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions of the
|
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
General Public License from time to time. Such new versions will be similar
|
|
||||||
in spirit to the present version, but may differ in detail to address new
|
|
||||||
problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||||
specifies a version number of this License which applies to it and "any later
|
|
||||||
version", you have the option of following the terms and conditions either of
|
|
||||||
that version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of this License,
|
|
||||||
you may choose any version ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free programs
|
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||||
whose distribution conditions are different, write to the author to ask for
|
|
||||||
permission. For software which is copyrighted by the Free Software
|
|
||||||
Foundation, write to the Free Software Foundation; we sometimes make
|
|
||||||
exceptions for this. Our decision will be guided by the two goals of
|
|
||||||
preserving the free status of all derivatives of our free software and of
|
|
||||||
promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
__NO WARRANTY__
|
__NO WARRANTY__
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
|
||||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
|
|
||||||
PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
|
|
||||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
|
||||||
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
|
|
||||||
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
|
||||||
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
|
|
||||||
DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR
|
|
||||||
A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
|
|
||||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
## License for wcslcat and wcslcpy
|
## License for wcslcat and wcslcpy
|
||||||
|
|
||||||
|
`fish` also contains small amounts of code under the BSD license, namely versions of the two functions strlcat and strlcpy, modified for use with wide character strings. This code is copyrighted by Todd C. Miller.
|
||||||
|
|
||||||
`fish` also contains small amounts of code under the BSD license, namely
|
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||||
versions of the two functions strlcat and strlcpy, modified for use with wide
|
|
||||||
character strings. This code is copyrighted by Todd C. Miller.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software for any purpose
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
with or without fee is hereby granted, provided that the above copyright
|
|
||||||
notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
||||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
||||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
||||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
## License for XSel
|
## License for XSel
|
||||||
|
|
||||||
|
The XSel command, written and copyrighted by Conrad Parker, is distributed together with `fish`.
|
||||||
The XSel command, written and copyrighted by Conrad Parker, is distributed
|
|
||||||
together with `fish`.
|
|
||||||
|
|
||||||
It is Copyright © 2001 Conrad Parker \<conrad@vergenet.net>
|
It is Copyright © 2001 Conrad Parker \<conrad@vergenet.net>
|
||||||
|
|
||||||
Permission to use, copy, modify, distribute, and sell this software and its
|
Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is"without express or implied warranty.
|
||||||
documentation for any purpose is hereby granted without fee, provided that the
|
|
||||||
above copyright notice appear in all copies and that both that copyright
|
|
||||||
notice and this permission notice appear in supporting documentation. No
|
|
||||||
representations are made about the suitability of this software for any
|
|
||||||
purpose. It is provided "as is"without express or implied warranty.
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
## License for xdgmime and glibc
|
## License for xdgmime and glibc
|
||||||
|
|
||||||
The xdgmime library, written and copyrighted by Red Hat, Inc, is used by the
|
The xdgmime library, written and copyrighted by Red Hat, Inc, is used by the mimedb command, which is a part of fish. It is released under the LGPL, version 2 or later, or under the Academic Free License, version 2. Version 2 of the LGPL license agreement is included below.
|
||||||
mimedb command, which is a part of fish. It is released under the LGPL,
|
|
||||||
version 2 or later, or under the Academic Free License, version 2. Version 2
|
|
||||||
of the LGPL license agreement is included below.
|
|
||||||
|
|
||||||
Fish contains code from the glibc library, namely the wcstok function. This
|
Fish contains code from the glibc library, namely the wcstok function. This code is licensed under the LGPL, version 2 or later. Version 2 of the LPGL license agreement is included below.
|
||||||
code is licensed under the LGPL, version 2 or later. Version 2 of the LPGL
|
|
||||||
license agreement is included below.
|
|
||||||
|
|
||||||
|
|
||||||
## <a name="LGPL2_SEC1"> GNU LESSER GENERAL PUBLIC LICENSE
|
## <a name="LGPL2_SEC1"> GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
Version 2.1, February 1999
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
@ -344,420 +151,146 @@ Version 2.1, February 1999
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts as the
|
[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
|
||||||
[successor of the GNU Library Public License, version 2, hence the version
|
|
||||||
[number 2.1.]
|
|
||||||
|
|
||||||
## <a name="LGPL2_SEC2"> Preamble
|
## <a name="LGPL2_SEC2"> Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your freedom to share
|
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software - to make sure the software is free for all its users.
|
||||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
|
||||||
guarantee your freedom to share and change free software - to make sure the
|
|
||||||
software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some specially
|
This license, the Lesser General Public License, applies to some specially designated software packages - typically libraries - of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
|
||||||
designated software packages - typically libraries - of the Free Software
|
|
||||||
Foundation and other authors who decide to use it. You can use it too, but we
|
|
||||||
suggest you first think carefully about whether this license or the ordinary
|
|
||||||
General Public License is the better strategy to use in any particular case,
|
|
||||||
based on the explanations below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use, not price.
|
When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
|
||||||
Our General Public Licenses are designed to make sure that you have the
|
|
||||||
freedom to distribute copies of free software (and charge for this service if
|
|
||||||
you wish); that you receive source code or can get it if you want it; that you
|
|
||||||
can change the software and use pieces of it in new free programs; and that
|
|
||||||
you are informed that you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid distributors
|
To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
|
||||||
to deny you these rights or to ask you to surrender these rights. These
|
|
||||||
restrictions translate to certain responsibilities for you if you distribute
|
|
||||||
copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis or for a
|
For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
|
||||||
fee, you must give the recipients all the rights that we gave you. You must
|
|
||||||
make sure that they, too, receive or can get the source code. If you link
|
|
||||||
other code with the library, you must provide complete object files to the
|
|
||||||
recipients, so that they can relink them with the library after making changes
|
|
||||||
to the library and recompiling it. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the library,
|
We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
|
||||||
and (2) we offer you this license, which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that there is no
|
To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
|
||||||
warranty for the free library. Also, if the library is modified by someone
|
|
||||||
else and passed on, the recipients should know that what they have is not the
|
|
||||||
original version, so that the original author's reputation will not be
|
|
||||||
affected by problems that might be introduced by others.
|
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of any free
|
Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
|
||||||
program. We wish to make sure that a company cannot effectively restrict the
|
|
||||||
users of a free program by obtaining a restrictive license from a patent
|
|
||||||
holder. Therefore, we insist that any patent license obtained for a version
|
|
||||||
of the library must be consistent with the full freedom of use specified in
|
|
||||||
this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
|
||||||
General Public License. This license, the GNU Lesser General Public License,
|
|
||||||
applies to certain designated libraries, and is quite different from the
|
|
||||||
ordinary General Public License. We use this license for certain libraries in
|
|
||||||
order to permit linking those libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using a shared
|
When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
|
||||||
library, the combination of the two is legally speaking a combined work, a
|
|
||||||
derivative of the original library. The ordinary General Public License
|
|
||||||
therefore permits such linking only if the entire combination fits its
|
|
||||||
criteria of freedom. The Lesser General Public License permits more lax
|
|
||||||
criteria for linking other code with the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it does Less
|
We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
|
||||||
to protect the user's freedom than the ordinary General Public License. It
|
|
||||||
also provides other free software developers Less of an advantage over
|
|
||||||
competing non-free programs. These disadvantages are the reason we use the
|
|
||||||
ordinary General Public License for many libraries. However, the Lesser
|
|
||||||
license provides advantages in certain special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to encourage the
|
For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
|
||||||
widest possible use of a certain library, so that it becomes a de-facto
|
|
||||||
standard. To achieve this, non-free programs must be allowed to use the
|
|
||||||
library. A more frequent case is that a free library does the same job as
|
|
||||||
widely used non-free libraries. In this case, there is little to gain by
|
|
||||||
limiting the free library to free software only, so we use the Lesser General
|
|
||||||
Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free programs
|
In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
|
||||||
enables a greater number of people to use a large body of free software. For
|
|
||||||
example, permission to use the GNU C Library in non-free programs enables many
|
|
||||||
more people to use the whole GNU operating system, as well as its variant, the
|
|
||||||
GNU/Linux operating system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the users'
|
Although the Lesser General Public License is Less protective of the users'freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
|
||||||
freedom, it does ensure that the user of a program that is linked with the
|
|
||||||
Library has the freedom and the wherewithal to run that program using a
|
The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
|
||||||
modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and modification
|
|
||||||
follow. Pay close attention to the difference between a "work based on the
|
|
||||||
library" and a "work that uses the library". The former contains code derived
|
|
||||||
from the library, whereas the latter must be combined with the library in
|
|
||||||
order to run.
|
|
||||||
|
|
||||||
## <a name="LGPL2_SEC3"> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
## <a name="LGPL2_SEC3"> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
- This License Agreement applies to any software library or other program which
|
- This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
|
||||||
contains a notice placed by the copyright holder or other authorized party
|
|
||||||
saying it may be distributed under the terms of this Lesser General Public
|
|
||||||
License (also called "this License"). Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data prepared so
|
A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
|
||||||
as to be conveniently linked with application programs (which use some of
|
|
||||||
those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work which has
|
The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
|
||||||
been distributed under these terms. A "work based on the Library" means
|
|
||||||
either the Library or any derivative work under copyright law: that is to say,
|
|
||||||
a work containing the Library or a portion of it, either verbatim or with
|
|
||||||
modifications and/or translated straightforwardly into another language.
|
|
||||||
(Hereinafter, translation is included without limitation in the term
|
|
||||||
"modification".)
|
|
||||||
|
|
||||||
"Source code for a work means the preferred form of the work for making
|
"Source code for a work" means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
|
||||||
"modifications to it. For a library, complete source code means all the
|
|
||||||
"source code for all modules it contains, plus any associated interface
|
|
||||||
"definition files, plus the scripts used to control compilation and
|
|
||||||
"installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not covered
|
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
|
||||||
by this License; they are outside its scope. The act of running a program
|
|
||||||
using the Library is not restricted, and output from such a program is covered
|
|
||||||
only if its contents constitute a work based on the Library (independent of
|
|
||||||
the use of the Library in a tool for writing it). Whether that is true
|
|
||||||
depends on what the Library does and what the program that uses the Library
|
|
||||||
does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's complete
|
1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
|
||||||
source code as you receive it, in any medium, provided that you conspicuously
|
|
||||||
and appropriately publish on each copy an appropriate copyright notice and
|
|
||||||
disclaimer of warranty; keep intact all the notices that refer to this License
|
|
||||||
and to the absence of any warranty; and distribute a copy of this License
|
|
||||||
along with the Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and you may
|
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||||
at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion of it,
|
2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||||
thus forming a work based on the Library, and copy and distribute such
|
|
||||||
modifications or work under the terms of Section 1 above, provided that you
|
|
||||||
also meet all of these conditions:
|
|
||||||
|
|
||||||
-# The modified work must itself be a software library.
|
-# The modified work must itself be a software library.
|
||||||
|
|
||||||
-# You must cause the files modified to carry prominent notices stating that
|
-# You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
|
||||||
you changed the files and the date of any change.
|
|
||||||
|
|
||||||
-# You must cause the whole of the work to be licensed at no charge to all
|
-# You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
|
||||||
third parties under the terms of this License.
|
|
||||||
|
|
||||||
-# If a facility in the modified Library refers to a function or a table of
|
-# If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
|
||||||
data to be supplied by an application program that uses the facility, other
|
|
||||||
than as an argument passed when the facility is invoked, then you must make
|
|
||||||
a good faith effort to ensure that, in the event an application does not
|
|
||||||
supply such function or table, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has a purpose
|
(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
|
||||||
that is entirely well-defined independent of the application. Therefore,
|
|
||||||
Subsection 2d requires that any application-supplied function or table used
|
|
||||||
by this function must be optional: if the application does not supply it, the
|
|
||||||
square root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If identifiable
|
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
sections of that work are not derived from the Library, and can be reasonably
|
|
||||||
considered independent and separate works in themselves, then this License,
|
|
||||||
and its terms, do not apply to those sections when you distribute them as
|
|
||||||
separate works. But when you distribute the same sections as part of a whole
|
|
||||||
which is a work based on the Library, the distribution of the whole must be on
|
|
||||||
the terms of this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest your
|
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
|
||||||
rights to work written entirely by you; rather, the intent is to exercise the
|
|
||||||
right to control the distribution of derivative or collective works based on
|
|
||||||
the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library with
|
In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||||
the Library (or with a work based on the Library) on a volume of a storage or
|
|
||||||
distribution medium does not bring the other work under the scope of this
|
|
||||||
License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
|
||||||
instead of this License to a given copy of the Library. To do this, you must
|
|
||||||
alter all the notices that refer to this License, so that they refer to the
|
|
||||||
ordinary GNU General Public License, version 2, instead of to this License.
|
|
||||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
|
||||||
has appeared, then you can specify that version instead if you wish.) Do not
|
|
||||||
make any other change in these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for that copy, so
|
Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
|
||||||
the ordinary GNU General Public License applies to all subsequent copies and
|
|
||||||
derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of the Library
|
This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
|
||||||
into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or derivative of it,
|
4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||||
under Section 2) in object code or executable form under the terms of Sections
|
|
||||||
1 and 2 above provided that you accompany it with the complete corresponding
|
|
||||||
machine-readable source code, which must be distributed under the terms of
|
|
||||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy from a
|
If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||||
designated place, then offering equivalent access to copy the source code from
|
|
||||||
the same place satisfies the requirement to distribute the source code, even
|
|
||||||
though third parties are not compelled to copy the source along with the
|
|
||||||
object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the Library, but is
|
5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
|
||||||
designed to work with the Library by being compiled or linked with it, is
|
|
||||||
called a "work that uses the Library". Such a work, in isolation, is not a
|
|
||||||
derivative work of the Library, and therefore falls outside the scope of this
|
|
||||||
License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library creates an
|
However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
|
||||||
executable that is a derivative of the Library (because it contains portions
|
|
||||||
of the Library), rather than a "work that uses the library". The executable
|
|
||||||
is therefore covered by this License. Section 6 states terms for distribution
|
|
||||||
of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file that is
|
When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
|
||||||
part of the Library, the object code for the work may be a derivative work of
|
|
||||||
the Library even though the source code is not. Whether this is true is
|
|
||||||
especially significant if the work can be linked without the Library, or if
|
|
||||||
the work is itself a library. The threshold for this to be true is not
|
|
||||||
precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data structure layouts
|
If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
|
||||||
and accessors, and small macros and small inline functions (ten lines or less
|
|
||||||
in length), then the use of the object file is unrestricted, regardless of
|
|
||||||
whether it is legally a derivative work. (Executables containing this object
|
|
||||||
code plus portions of the Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may distribute the
|
Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
|
||||||
object code for the work under the terms of Section 6. Any executables
|
|
||||||
containing that work also fall under Section 6, whether or not they are linked
|
|
||||||
directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or link a "work
|
6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
|
||||||
that uses the Library" with the Library to produce a work containing portions
|
|
||||||
of the Library, and distribute that work under terms of your choice, provided
|
|
||||||
that the terms permit modification of the work for the customer's own use and
|
|
||||||
reverse engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the Library is
|
You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
|
||||||
used in it and that the Library and its use are covered by this License. You
|
|
||||||
must supply a copy of this License. If the work during execution displays
|
|
||||||
copyright notices, you must include the copyright notice for the Library among
|
|
||||||
them, as well as a reference directing the user to the copy of this License.
|
|
||||||
Also, you must do one of these things:
|
|
||||||
|
|
||||||
-# Accompany the work with the complete corresponding machine-readable source
|
-# Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine- readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
|
||||||
code for the Library including whatever changes were used in the work
|
|
||||||
(which must be distributed under Sections 1 and 2 above); and, if the work
|
|
||||||
is an executable linked with the Library, with the complete machine-
|
|
||||||
readable "work that uses the Library", as object code and/or source code,
|
|
||||||
so that the user can modify the Library and then relink to produce a
|
|
||||||
modified executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the Library
|
|
||||||
will not necessarily be able to recompile the application to use the
|
|
||||||
modified definitions.)
|
|
||||||
|
|
||||||
-# Use a suitable shared library mechanism for linking with the Library. A
|
-# Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
|
||||||
suitable mechanism is one that (1) uses at run time a copy of the library
|
|
||||||
already present on the user's computer system, rather than copying library
|
|
||||||
functions into the executable, and (2) will operate properly with a
|
|
||||||
modified version of the library, if the user installs one, as long as the
|
|
||||||
modified version is interface-compatible with the version that the work was
|
|
||||||
made with.
|
|
||||||
|
|
||||||
-# Accompany the work with a written offer, valid for at least three years, to
|
-# Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
|
||||||
give the same user the materials specified in Subsection 6a, above, for a
|
|
||||||
charge no more than the cost of performing this distribution.
|
|
||||||
|
|
||||||
-# If distribution of the work is made by offering access to copy from a
|
-# If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
|
||||||
designated place, offer equivalent access to copy the above specified
|
|
||||||
materials from the same place.
|
|
||||||
|
|
||||||
-# Verify that the user has already received a copy of these materials or that
|
-# Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
|
||||||
you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the Library" must
|
For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||||
include any data and utility programs needed for reproducing the executable
|
|
||||||
from it. However, as a special exception, the materials to be distributed
|
|
||||||
need not include anything that is normally distributed (in either source or
|
|
||||||
binary form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component itself
|
|
||||||
accompanies the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license restrictions of
|
It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
|
||||||
other proprietary libraries that do not normally accompany the operating
|
|
||||||
system. Such a contradiction means you cannot use both them and the Library
|
|
||||||
together in an executable that you distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the Library side-
|
7. You may place library facilities that are a work based on the Library side- by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
|
||||||
by-side in a single library together with other library facilities not covered
|
|
||||||
by this License, and distribute such a combined library, provided that the
|
|
||||||
separate distribution of the work based on the Library and of the other
|
|
||||||
library facilities is otherwise permitted, and provided that you do these two
|
|
||||||
things:
|
|
||||||
|
|
||||||
-# Accompany the combined library with a copy of the same work based on the
|
-# Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
|
||||||
Library, uncombined with any other library facilities. This must be
|
|
||||||
distributed under the terms of the Sections above.
|
|
||||||
|
|
||||||
-# Give prominent notice with the combined library of the fact that part of it
|
-# Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||||
except as expressly provided under this License. Any attempt otherwise to
|
|
||||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
|
||||||
will automatically terminate your rights under this License. However, parties
|
|
||||||
who have received copies, or rights, from you under this License will not have
|
|
||||||
their licenses terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not signed it.
|
9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
|
||||||
However, nothing else grants you permission to modify or distribute the
|
|
||||||
Library or its derivative works. These actions are prohibited by law if you
|
|
||||||
do not accept this License. Therefore, by modifying or distributing the
|
|
||||||
Library (or any work based on the Library), you indicate your acceptance of
|
|
||||||
this License to do so, and all its terms and conditions for copying,
|
|
||||||
distributing or modifying the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the Library),
|
10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients'exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
the recipient automatically receives a license from the original licensor to
|
|
||||||
copy, distribute, link with or modify the Library subject to these terms and
|
|
||||||
conditions. You may not impose any further restrictions on the recipients'
|
|
||||||
exercise of the rights granted herein. You are not responsible for enforcing
|
|
||||||
compliance by third parties with this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or otherwise)
|
|
||||||
that contradict the conditions of this License, they do not excuse you from
|
|
||||||
the conditions of this License. If you cannot distribute so as to satisfy
|
|
||||||
simultaneously your obligations under this License and any other pertinent
|
|
||||||
obligations, then as a consequence you may not distribute the Library at all.
|
|
||||||
For example, if a patent license would not permit royalty-free redistribution
|
|
||||||
of the Library by all those who receive copies directly or indirectly through
|
|
||||||
you, then the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
|
||||||
particular circumstance, the balance of the section is intended to apply, and
|
|
||||||
the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any patents or
|
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||||
other property right claims or to contest validity of any such claims; this
|
|
||||||
section has the sole purpose of protecting the integrity of the free software
|
|
||||||
distribution system which is implemented by public license practices. Many
|
|
||||||
people have made generous contributions to the wide range of software
|
|
||||||
distributed through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing to
|
|
||||||
distribute software through any other system and a licensee cannot impose that
|
|
||||||
choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to be a
|
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||||
consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in certain
|
12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||||
countries either by patents or by copyrighted interfaces, the original
|
|
||||||
copyright holder who places the Library under this License may add an explicit
|
|
||||||
geographical distribution limitation excluding those countries, so that
|
|
||||||
distribution is permitted only in or among countries not thus excluded. In
|
|
||||||
such case, this License incorporates the limitation as if written in the body
|
|
||||||
of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new versions of
|
13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
the Lesser General Public License from time to time. Such new versions will be
|
|
||||||
similar in spirit to the present version, but may differ in detail to address
|
|
||||||
new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
|
||||||
specifies a version number of this License which applies to it and "any later
|
|
||||||
version", you have the option of following the terms and conditions either of
|
|
||||||
that version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Library does not specify a license version number, you may
|
|
||||||
choose any version ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free programs
|
14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||||
whose distribution conditions are incompatible with these, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free Software
|
|
||||||
Foundation, write to the Free Software Foundation; we sometimes make
|
|
||||||
exceptions for this. Our decision will be guided by the two goals of
|
|
||||||
preserving the free status of all derivatives of our free software and of
|
|
||||||
promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
__NO WARRANTY__
|
__NO WARRANTY__
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
|
||||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
|
|
||||||
LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
|
|
||||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
|
||||||
PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE,
|
|
||||||
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
|
||||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
|
||||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
|
|
||||||
DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR
|
|
||||||
A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
|
||||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -765,9 +298,7 @@ HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
## License for printf
|
## License for printf
|
||||||
|
|
||||||
Copyright © 1990-2007 Free Software Foundation, Inc. Printf (from GNU
|
Copyright © 1990-2007 Free Software Foundation, Inc. Printf (from GNU Coreutils 6.9) is released under the GNU General Public License, version 2. The license agreement is included below.
|
||||||
Coreutils 6.9) is released under the GNU General Public License, version 2.
|
|
||||||
The license agreement is included below.
|
|
||||||
|
|
||||||
|
|
||||||
# <a name="GPL2_SEC1"> GNU GENERAL PUBLIC LICENSE
|
# <a name="GPL2_SEC1"> GNU GENERAL PUBLIC LICENSE
|
||||||
|
@ -785,50 +316,21 @@ Version 2, June 1991
|
||||||
## Preamble
|
## Preamble
|
||||||
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your freedom to share
|
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software - to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
|
||||||
and change it. By contrast, the GNU General Public License is intended to
|
|
||||||
guarantee your freedom to share and change free software - to make sure the
|
|
||||||
software is free for all its users. This General Public License applies to
|
|
||||||
most of the Free Software Foundation's software and to any other program whose
|
|
||||||
authors commit to using it. (Some other Free Software Foundation software is
|
|
||||||
covered by the GNU Library General Public License instead.) You can apply it
|
|
||||||
to your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not price. Our
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||||
General Public Licenses are designed to make sure that you have the freedom to
|
|
||||||
distribute copies of free software (and charge for this service if you wish),
|
|
||||||
that you receive source code or can get it if you want it, that you can change
|
|
||||||
the software or use pieces of it in new free programs; and that you know you
|
|
||||||
can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid anyone to
|
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||||
deny you these rights or to ask you to surrender the rights. These
|
|
||||||
restrictions translate to certain responsibilities for you if you distribute
|
|
||||||
copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether gratis or for
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||||
a fee, you must give the recipients all the rights that you have. You must
|
|
||||||
make sure that they, too, receive or can get the source code. And you must
|
|
||||||
show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||||
offer you this license which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain that
|
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||||
everyone understands that there is no warranty for this free software. If the
|
|
||||||
software is modified by someone else and passed on, we want its recipients to
|
|
||||||
know that what they have is not the original, so that any problems introduced
|
|
||||||
by others will not reflect on the original authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software patents. We
|
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||||
wish to avoid the danger that redistributors of a free program will
|
|
||||||
individually obtain patent licenses, in effect making the program proprietary.
|
|
||||||
To prevent this, we have made it clear that any patent must be licensed for
|
|
||||||
everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and modification
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
follow.
|
|
||||||
|
|
||||||
|
|
||||||
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
@ -1073,17 +575,9 @@ POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
Copyright © 2007 Alexey Vatchenko \<av@bsdua.org>
|
Copyright © 2007 Alexey Vatchenko \<av@bsdua.org>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
||||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
||||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
\htmlonly[block]
|
\htmlonly[block]
|
||||||
|
|
|
@ -8,21 +8,13 @@ math EXPRESSION
|
||||||
|
|
||||||
\subsection math-description Description
|
\subsection math-description Description
|
||||||
|
|
||||||
`math` is used to perform mathematical calculations. It is a very
|
`math` is used to perform mathematical calculations. It is a very thin wrapper for the bc program, which makes it possible to specify an expression from the command line without using non-standard extensions or a pipeline.
|
||||||
thin wrapper for the bc program, which makes it possible to specify an
|
|
||||||
expression from the command line without using non-standard extensions
|
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 shell variables or the output of command substitutions, but it also means that parenthesis have to be escaped.
|
||||||
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 shell variables or the
|
|
||||||
output of command substitutions, but it also means that parenthesis
|
|
||||||
have to be escaped.
|
|
||||||
|
|
||||||
\subsection math-example Examples
|
\subsection math-example Examples
|
||||||
|
|
||||||
`math 1+1` outputs 2.
|
`math 1+1` outputs 2.
|
||||||
|
|
||||||
`math $status-128` outputs the numerical exit status of the
|
`math $status-128` outputs the numerical exit status of the last command minus 128.
|
||||||
last command minus 128.
|
|
||||||
|
|
|
@ -7,22 +7,24 @@ mimedb [OPTIONS] FILES...
|
||||||
|
|
||||||
\subsection mimedb-description Description
|
\subsection mimedb-description Description
|
||||||
|
|
||||||
\c mimedb queries the MIME type database and the `.desktop` files
|
`mimedb` queries the MIME type database and the `.desktop` files installed on the system in order to find information on the files listed in `FILES`. The information that `mimedb` can retrieve includes the MIME type for a file, a description of the type, and the default action that can be performed on the file. `mimedb` can also be used to launch the default action for this file.
|
||||||
installed on the system in order to find information on
|
|
||||||
the files listed in `FILES`. The information that `mimedb`
|
|
||||||
can retrieve includes the MIME type for a file, a description of the type,
|
|
||||||
and the default action that can be performed on the file. `mimedb` can also
|
|
||||||
be used to launch the default action for this file.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-t`, `--input-file-data` determines the files' type both by their filename and by their contents (default behaviour).
|
- `-t`, `--input-file-data` determines the files' type both by their filename and by their contents (default behaviour).
|
||||||
- `-f`, `--input-filename` determines the files' type by their filename.
|
|
||||||
- `-i`, `--input-mime` specifies that the arguments are not files, but MIME types.
|
|
||||||
- `-m`, `--output-mime` outputs the MIME type of each file (default behaviour).
|
|
||||||
- `-f`, `--output-description` outputs the description of each MIME type.
|
|
||||||
- `-a`, `--output-action` outputs the default action of each MIME type.
|
|
||||||
- `-l`, `--launch` launches the default action for the specified files.
|
|
||||||
- `-h`, `--help` displays a help message and exit.
|
|
||||||
- `-v`, `--version` displays the version number and exits.
|
|
||||||
|
|
||||||
|
- `-f`, `--input-filename` determines the files' type by their filename.
|
||||||
|
|
||||||
|
- `-i`, `--input-mime` specifies that the arguments are not files, but MIME types.
|
||||||
|
|
||||||
|
- `-m`, `--output-mime` outputs the MIME type of each file (default behaviour).
|
||||||
|
|
||||||
|
- `-f`, `--output-description` outputs the description of each MIME type.
|
||||||
|
|
||||||
|
- `-a`, `--output-action` outputs the default action of each MIME type.
|
||||||
|
|
||||||
|
- `-l`, `--launch` launches the default action for the specified files.
|
||||||
|
|
||||||
|
- `-h`, `--help` displays a help message and exit.
|
||||||
|
|
||||||
|
- `-v`, `--version` displays the version number and exits.
|
||||||
|
|
|
@ -6,11 +6,11 @@ nextd [-l | --list] [POS]
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection nextd-description Description
|
\subsection nextd-description Description
|
||||||
`nextd` moves forwards `POS` positions in the history of visited
|
|
||||||
directories; if the end of the history has been hit, a warning is printed.
|
|
||||||
|
|
||||||
If the `-l` or `--list` flag is specified, the current
|
`nextd` moves forwards `POS` positions in the history of visited directories; if the end of the history has been hit, a warning is printed.
|
||||||
directory history is also displayed.
|
|
||||||
|
If the `-l` or `--list` flag is specified, the current directory history is also displayed.
|
||||||
|
|
||||||
|
|
||||||
\subsection nextd-example Example
|
\subsection nextd-example Example
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ not COMMAND [OPTIONS...]
|
||||||
|
|
||||||
\subsection not-description Description
|
\subsection not-description Description
|
||||||
|
|
||||||
`not` negates the exit status of another command. If the exit status
|
`not` negates the exit status of another command. If the exit status is zero, `not` returns 1. Otherwise, `not` returns 0.
|
||||||
is zero, `not` returns 1. Otherwise, `not` returns 0.
|
|
||||||
|
|
||||||
\subsection not-example Example
|
\subsection not-example Example
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ open FILES...
|
||||||
|
|
||||||
`open` opens a file in its default application, using the `xdg-open` command if it exists, or else the <a href="commands.html#mimedb">mimedb</a> command.
|
`open` opens a file in its default application, using the `xdg-open` command if it exists, or else the <a href="commands.html#mimedb">mimedb</a> command.
|
||||||
|
|
||||||
|
|
||||||
\subsection open-example Example
|
\subsection open-example Example
|
||||||
|
|
||||||
`open *.txt` opens all the text files in the current directory using your system's default text editor.
|
`open *.txt` opens all the text files in the current directory using your system's default text editor.
|
||||||
|
|
|
@ -7,23 +7,17 @@ COMMAND1; or COMMAND2
|
||||||
|
|
||||||
\subsection or-description Description
|
\subsection or-description Description
|
||||||
|
|
||||||
`or` is used to execute a command if the current exit
|
`or` is used to execute a command if the current exit status (as set by the last previous command) is not 0.
|
||||||
status (as set by the last previous command) is not 0.
|
|
||||||
|
|
||||||
`or` does not change the current exit status.
|
`or` does not change the current exit status.
|
||||||
|
|
||||||
The exit status of the last foreground command to exit can always be
|
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||||
accessed using the <a href="index.html#variables-status">$status</a>
|
|
||||||
variable.
|
|
||||||
|
|
||||||
\subsection or-example Example
|
\subsection or-example Example
|
||||||
|
|
||||||
The following code runs the `make` command to build a program. If the
|
The following code runs the `make` command to build a program. If the build succeeds, the program is installed. If either step fails, `make clean` is run, which removes the files created by the build process.
|
||||||
build succeeds, the program is installed. If either step fails,
|
|
||||||
`make clean` is run, which removes the files created by the
|
|
||||||
build process.
|
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
make; and make install; or make clean
|
make; and make install; or make clean
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,8 @@ popd
|
||||||
|
|
||||||
\subsection popd-description Description
|
\subsection popd-description Description
|
||||||
|
|
||||||
`popd` removes the top directory from the directory stack and
|
`popd` removes the top directory from the directory stack and changes the working directory to the new top directory. Use <a href="#pushd">`pushd`</a> to add directories to the stack.
|
||||||
changes the working directory to the new top directory. Use <a
|
|
||||||
href="#pushd">`pushd`</a> to add directories to the stack.
|
|
||||||
|
|
||||||
\subsection popd-example Example
|
\subsection popd-example Example
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,10 @@ prevd [ -l | --list ] [POS]
|
||||||
|
|
||||||
\subsection prevd-description Description
|
\subsection prevd-description Description
|
||||||
|
|
||||||
`prevd` moves backwards `POS` positions in the history
|
`prevd` moves backwards `POS` positions in the history of visited directories; if the beginning of the history has been hit, a warning is printed.
|
||||||
of visited directories; if the beginning of the history has been hit,
|
|
||||||
a warning is printed.
|
If the `-l` or `--list` flag is specified, the current history is also displayed.
|
||||||
|
|
||||||
If the `-l` or `--list` flag is specified, the current
|
|
||||||
history is also displayed.
|
|
||||||
|
|
||||||
\subsection prevd-example Example
|
\subsection prevd-example Example
|
||||||
|
|
||||||
|
|
|
@ -7,20 +7,10 @@ COMMAND1 (COMMAND2 | psub [-f])
|
||||||
|
|
||||||
\subsection psub-description Description
|
\subsection psub-description Description
|
||||||
|
|
||||||
Posix shells feature a syntax that is a mix between command
|
Posix shells feature a syntax that is a mix between command substitution and piping, called process substitution. It is used to send the output of a command into the calling command, much like command substitution, but with the difference that the output is not sent through commandline arguments but through a named pipe, with the filename of the named pipe sent as an argument to the calling program. `psub` combined with a regular command substitution provides the same functionality.
|
||||||
substitution and piping, called process substitution. It is used to
|
|
||||||
send the output of a command into the calling command, much like
|
If the `-f` or `--file` switch is given to `psub`, `psub` will use a regular file instead of a named pipe to communicate with the calling process. This will cause `psub` to be significantly slower when large amounts of data are involved, but has the advantage that the reading process can seek in the stream.
|
||||||
command substitution, but with the difference that the output is not
|
|
||||||
sent through commandline arguments but through a named pipe, with the
|
|
||||||
filename of the named pipe sent as an argument to the calling
|
|
||||||
program. `psub` combined with a
|
|
||||||
regular command substitution provides the same functionality.
|
|
||||||
|
|
||||||
If the `-f` or `--file` switch is given to `psub`, `psub` will use a
|
|
||||||
regular file instead of a named pipe to communicate with the calling
|
|
||||||
process. This will cause `psub` to be significantly slower when large
|
|
||||||
amounts of data are involved, but has the advantage that the reading
|
|
||||||
process can seek in the stream.
|
|
||||||
|
|
||||||
\subsection psub-example Example
|
\subsection psub-example Example
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ pushd [DIRECTORY]
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection pushd-description Description
|
\subsection pushd-description Description
|
||||||
The `pushd` function adds `DIRECTORY` to the top of the directory stack
|
|
||||||
and makes it the current working directory. <a href="#popd">`popd`</a> will pop it off and
|
The `pushd` function adds `DIRECTORY` to the top of the directory stack and makes it the current working directory. <a href="#popd">`popd`</a> will pop it off and return to the original directory.
|
||||||
return to the original directory.
|
|
||||||
|
|
||||||
\subsection pushd-example Example
|
\subsection pushd-example Example
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,8 @@ random [SEED]
|
||||||
|
|
||||||
`random` outputs a random number from 0 to 32766, inclusive.
|
`random` outputs a random number from 0 to 32766, inclusive.
|
||||||
|
|
||||||
If a `SEED` value is provided, it is used to seed the random number
|
If a `SEED` value is provided, it is used to seed the random number generator, and no output will be produced. This can be useful for debugging purposes, where it can be desirable to get the same random number sequence multiple times. If the random number generator is called without first seeding it, the current time will be used as the seed.
|
||||||
generator, and no output will be produced. This can be useful for debugging
|
|
||||||
purposes, where it can be desirable to get the same random number sequence
|
|
||||||
multiple times. If the random number generator is called without first
|
|
||||||
seeding it, the current time will be used as the seed.
|
|
||||||
|
|
||||||
\subsection random-example Example
|
\subsection random-example Example
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ read [OPTIONS] [VARIABLES...]
|
||||||
|
|
||||||
\subsection read-description Description
|
\subsection read-description Description
|
||||||
|
|
||||||
`read` reads one line from standard
|
`read` reads one line from standard input and stores the result in one or more shell variables.
|
||||||
input and stores the result in one or more shell variables.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
|
@ -33,12 +32,12 @@ input is considered a separate token.
|
||||||
If \c -a or \c --array is provided, only one variable name is allowed and the
|
If \c -a or \c --array is provided, only one variable name is allowed and the
|
||||||
tokens are stored as an array in this variable.
|
tokens are stored as an array in this variable.
|
||||||
|
|
||||||
See the documentation for `set` for more details on the scoping rules for
|
|
||||||
variables.
|
|
||||||
|
|
||||||
\subsection read-example Example
|
\subsection read-example Example
|
||||||
|
|
||||||
The following code stores the value 'hello' in the shell variable
|
The following code stores the value 'hello' in the shell variable
|
||||||
`$foo`.
|
`$foo`.
|
||||||
|
|
||||||
`echo hello|read foo`
|
\fish
|
||||||
|
echo hello|read foo
|
||||||
|
\endfish
|
||||||
|
|
|
@ -7,16 +7,13 @@ function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end
|
||||||
|
|
||||||
\subsection return-description Description
|
\subsection return-description Description
|
||||||
|
|
||||||
`return` halts a currently running function. The exit status is set
|
`return` halts a currently running function. The exit status is set to `STATUS` if it is given.
|
||||||
to `STATUS` if it is given.
|
|
||||||
|
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, but it can also be used to specify the exit status of a 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, but it can also be used to specify the exit status of a
|
|
||||||
function.
|
|
||||||
|
|
||||||
\subsection return-example Example
|
\subsection return-example Example
|
||||||
|
|
||||||
The following code is an implementation of the false command as a fish function
|
The following code is an implementation of the false command as a fish function
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
|
|
|
@ -12,74 +12,66 @@ set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
||||||
|
|
||||||
\subsection set-description Description
|
\subsection set-description Description
|
||||||
|
|
||||||
`set` manipulates <a href="index.html#variables">shell
|
`set` manipulates <a href="index.html#variables">shell variables</a>.
|
||||||
variables</a>.
|
|
||||||
|
|
||||||
If set is called with no arguments, the names and values of all
|
If set is called with no arguments, the names and values of all shell variables are printed. If some of the scope or export flags have been given, only the variables matching the specified scope are printed.
|
||||||
shell variables are printed. If some of the scope or export
|
|
||||||
flags have been given, only the variables matching the specified scope
|
|
||||||
are printed.
|
|
||||||
|
|
||||||
With both variable names and values provided, `set` assigns the variable
|
With both variable names and values provided, `set` assigns the variable `VARIABLE_NAME` the values `VALUES...`.
|
||||||
`VARIABLE_NAME` the values `VALUES...`.
|
|
||||||
|
|
||||||
The following options control variable scope:
|
The following options control variable scope:
|
||||||
|
|
||||||
- `-l` or `--local` 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
|
- `-l` or `--local` 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
|
||||||
|
|
||||||
- `-g` or `--global` causes the specified shell variable to be given a global scope. Non-global variables disappear when the block they belong to ends
|
- `-g` or `--global` causes the specified shell variable to be given a global scope. Non-global variables disappear when the block they belong to ends
|
||||||
|
|
||||||
- `-U` or `--universal` 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.
|
- `-U` or `--universal` 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.
|
||||||
|
|
||||||
- `-x` or `--export` causes the specified shell variable to be exported to child processes (making it an "environment variable")
|
- `-x` or `--export` causes the specified shell variable to be exported to child processes (making it an "environment variable")
|
||||||
|
|
||||||
- `-u` or `--unexport` causes the specified shell variable to NOT be exported to child processes
|
- `-u` or `--unexport` causes the specified shell variable to NOT be exported to child processes
|
||||||
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-e` or `--erase` causes the specified shell variable to be erased
|
- `-e` or `--erase` causes the specified shell variable to be erased
|
||||||
|
|
||||||
- `-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.
|
- `-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.
|
||||||
|
|
||||||
- `-n` or `--names` List only the names of all defined variables, not their value
|
- `-n` or `--names` List only the names of all defined variables, not their value
|
||||||
|
|
||||||
- `-L` or `--long` do not abbreviate long values when printing set variables
|
- `-L` or `--long` do not abbreviate long values when printing set variables
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
If the variable name is one or more array elements, such as
|
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.
|
||||||
`PATH[1 3 7]`, only those array elements specified will be
|
|
||||||
changed. When array indices are specified to `set`, multiple arguments
|
If the variable name is one or more array elements, such as `PATH[1 3 7]`, only those array elements specified will be 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 you specify a negative index when expanding or assigning to an array variable, the index will be calculated from the end of the array. For example, the index -1 means the last index of an array.
|
||||||
may be used to specify additional indexes, e.g. `set PATH[1]
|
|
||||||
PATH[4] /bin /sbin`. If you specify a negative index when
|
|
||||||
expanding or assigning to an array variable, the index will be
|
|
||||||
calculated from the end of the array. For example, the index -1 means
|
|
||||||
the last index of an array.
|
|
||||||
|
|
||||||
The scoping rules when creating or updating a variable are:
|
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 of the same name exists in a different scope, that variable will not be 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 previous variable scope is used.
|
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the previous 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 function. Note that this is different from using the `-l` or `--local` flag. If one of those flags is used, the variable will be local to the most inner currently executing block, while without these the variable will be local to the function. If no function is executing, the variable will be global.
|
-# 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 function. Note that this is different from using the `-l` or `--local` flag. If one of those flags is used, the variable will be local to the most inner currently executing block, while without these the variable will be local to the function. If no function is executing, the variable will be global.
|
||||||
|
|
||||||
The exporting rules when creating or updating a variable are identical
|
|
||||||
to the scoping rules for variables:
|
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 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 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 exported or unexported and has never before been defined, the variable will not be exported.
|
-# If a variable is not explicitly set to be either exported or unexported and has never before been defined, the variable will not be exported.
|
||||||
|
|
||||||
|
|
||||||
In query mode, the scope to be examined can be specified.
|
In query mode, the scope to be examined can be specified.
|
||||||
|
|
||||||
In erase mode, if variable indices are specified, only the specified
|
In erase mode, if variable indices are specified, only the specified slices of the array variable will be erased.
|
||||||
slices of the array variable will be erased.
|
|
||||||
|
|
||||||
`set` requires all options to come before any
|
`set` requires all options to come before any other arguments. For example, `set flags -l` will have the effect of setting the value of the variable `flags` to '-l', not making the variable local.
|
||||||
other arguments. For example, `set flags -l` will have
|
|
||||||
the effect of setting the value of the variable `flags` to
|
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. `if set output (command)`. 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.
|
||||||
'-l', not making the variable local.
|
|
||||||
|
|
||||||
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. `if set output
|
|
||||||
(command)`. 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
|
\subsection set-example Example
|
||||||
\fish
|
\fish
|
||||||
|
|
|
@ -7,36 +7,31 @@ set_color [OPTIONS] [COLOR]
|
||||||
|
|
||||||
\subsection set_color-description Description
|
\subsection set_color-description Description
|
||||||
|
|
||||||
`set_color` changes the foreground and/or background color of the terminal.
|
`set_color` changes the foreground and/or background color of the terminal. `COLOR` is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal.
|
||||||
`COLOR` is one of black, red, green, brown, yellow, blue, magenta,
|
|
||||||
purple, cyan, white and normal.
|
|
||||||
|
|
||||||
If your terminal supports term256 (modern xterms and OS X Lion),
|
If your terminal supports term256 (modern xterms and OS X Lion), you can specify an RGB value with three or six hex digits, such as A0FF33 or f2f. `fish` will choose the closest supported color.
|
||||||
you can specify an RGB value with three or six hex digits, such
|
|
||||||
as A0FF33 or f2f. `fish` will choose the closest supported color.
|
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-b`, `--background` `COLOR` sets the background color.
|
- `-b`, `--background` `COLOR` sets the background color.
|
||||||
|
|
||||||
- `-c`, `--print-colors` prints a list of all valid color names.
|
- `-c`, `--print-colors` prints a list of all valid color names.
|
||||||
|
|
||||||
- `-h`, `--help` displays a help message and exit.
|
- `-h`, `--help` displays a help message and exit.
|
||||||
|
|
||||||
- `-o`, `--bold` sets bold or extra bright mode.
|
- `-o`, `--bold` sets bold or extra bright mode.
|
||||||
|
|
||||||
- `-u`, `--underline` sets underlined mode.
|
- `-u`, `--underline` sets underlined mode.
|
||||||
|
|
||||||
Calling `set_color normal` will set the terminal color to
|
|
||||||
the default color of the terminal.
|
|
||||||
|
|
||||||
Some terminals use the `--bold` escape sequence to switch to a brighter
|
Calling `set_color normal` will set the terminal color to the default color of the terminal.
|
||||||
color set. On such terminals, `set_color white` will result
|
|
||||||
in a grey font color, while `set_color --bold white` will
|
Some terminals use the `--bold` escape sequence to switch to a brighter color set. On such terminals, `set_color white` will result in a grey font color, while `set_color --bold white` will result in a white font color.
|
||||||
result in a white font color.
|
|
||||||
|
|
||||||
Not all terminal emulators support all these features.
|
Not all terminal emulators support all these features.
|
||||||
|
|
||||||
`set_color` uses the terminfo database to look up how to change terminal
|
`set_color` uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it.
|
||||||
colors on whatever terminal is in use. Some systems have old and
|
|
||||||
incomplete terminfo databases, and may lack color information for
|
|
||||||
terminals that support it.
|
|
||||||
|
|
||||||
\subsection set_color-example Examples
|
\subsection set_color-example Examples
|
||||||
|
|
||||||
|
|
|
@ -7,26 +7,17 @@ source FILENAME [ARGUMENTS...]
|
||||||
|
|
||||||
\subsection source-description Description
|
\subsection source-description Description
|
||||||
|
|
||||||
`source` evaluates the commands of the specified file in the current
|
`source` evaluates the commands of the specified file in the current shell. This is different from starting a new process to perform the commands (i.e. `fish < FILENAME`) since the commands will be evaluated by the current shell, which means that changes in shell variables will affect the current shell. If additional arguments are specified after the file name, they will be inserted into the $argv variable.
|
||||||
shell. This is different from starting a new process to perform the
|
|
||||||
commands (i.e. `fish < FILENAME`) since the commands will be
|
|
||||||
evaluated by the current shell, which means that changes in
|
|
||||||
shell variables will affect the current shell. If additional arguments are
|
|
||||||
specified after the file name, they will be inserted into the $argv
|
|
||||||
variable.
|
|
||||||
|
|
||||||
If no file is specified, or if the file name '`-`' is used, stdin will
|
If no file is specified, or if the file name '`-`' is used, stdin will be read.
|
||||||
be read.
|
|
||||||
|
|
||||||
The return status of `source` is the return status of the last job to
|
The return status of `source` is the return status of the last job to execute. If something goes wrong while opening or reading the file, `source` exits with a non-zero status.
|
||||||
execute. If something goes wrong while opening or reading the file,
|
|
||||||
`source` exits with a non-zero status.
|
`.` (a single period) is an alias for the `source` command. The use of `.` is deprecated in favour of `source`, and `.` will be removed in a future version of fish.
|
||||||
|
|
||||||
`.` (a single period) is an alias for the `source` command. The use of `.`
|
|
||||||
is deprecated in favour of `source`, and `.` will be removed in a future
|
|
||||||
version of fish.
|
|
||||||
|
|
||||||
\subsection source-example Example
|
\subsection source-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
source ~/.config/fish/config.fish
|
source ~/.config/fish/config.fish
|
||||||
# Causes fish to re-read its initialization file.
|
# Causes fish to re-read its initialization file.
|
||||||
|
|
|
@ -6,18 +6,31 @@ status [OPTION]
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection status-description Description
|
\subsection status-description Description
|
||||||
|
|
||||||
With no arguments, `status` displays a summary of the current login and job control status of the shell.
|
With no arguments, `status` displays a summary of the current login and job control status of the shell.
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
- `-c` or `--is-command-substitution` returns 0 if fish is currently executing a command substitution.
|
- `-c` or `--is-command-substitution` returns 0 if fish is currently executing a command substitution.
|
||||||
|
|
||||||
- `-b` or `--is-block` returns 0 if fish is currently executing a block of code.
|
- `-b` or `--is-block` returns 0 if fish is currently executing a block of code.
|
||||||
|
|
||||||
- `-i` or `--is-interactive` returns 0 if fish is interactive - that is, connected to a keyboard.
|
- `-i` or `--is-interactive` returns 0 if fish is interactive - that is, connected to a keyboard.
|
||||||
|
|
||||||
- `-l` or `--is-login` returns 0 if fish is a login shell - that is, if fish should perform login tasks such as setting up the PATH.
|
- `-l` or `--is-login` returns 0 if fish is a login shell - that is, if fish should perform login tasks such as setting up the PATH.
|
||||||
|
|
||||||
- `--is-full-job-control` returns 0 if full job control is enabled.
|
- `--is-full-job-control` returns 0 if full job control is enabled.
|
||||||
|
|
||||||
- `--is-interactive-job-control` returns 0 if interactive job control is enabled.
|
- `--is-interactive-job-control` returns 0 if interactive job control is enabled.
|
||||||
|
|
||||||
- `--is-no-job-control` returns 0 if no job control is enabled.
|
- `--is-no-job-control` returns 0 if no job control is enabled.
|
||||||
|
|
||||||
- `-f` or `--current-filename` prints the filename of the currently running script.
|
- `-f` or `--current-filename` prints the filename of the currently running script.
|
||||||
|
|
||||||
- `-n` or `--current-line-number` prints the line number of the currently running script.
|
- `-n` or `--current-line-number` prints the line number of the currently running script.
|
||||||
|
|
||||||
- `-j CONTROLTYPE` or `--job-control=CONTROLTYPE` sets the job control type, which can be `none`, `full`, or `interactive`.
|
- `-j CONTROLTYPE` or `--job-control=CONTROLTYPE` sets the job control type, which can be `none`, `full`, or `interactive`.
|
||||||
|
|
||||||
- `-t` or `--print-stack-trace` prints a stack trace of all function calls on the call stack.
|
- `-t` or `--print-stack-trace` prints a stack trace of all function calls on the call stack.
|
||||||
|
|
||||||
- `-h` or `--help` displays a help message and exit.
|
- `-h` or `--help` displays a help message and exit.
|
||||||
|
|
|
@ -7,29 +7,18 @@ switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||||
|
|
||||||
\subsection switch-description Description
|
\subsection switch-description Description
|
||||||
|
|
||||||
`switch` performs one of several blocks of commands, depending on whether
|
`switch` performs one of several blocks of commands, depending on whether a specified value equals one of several wildcarded values. `case` is used together with the `switch` statement in order to determine which block should be executed.
|
||||||
a specified value equals one of several wildcarded values. `case` is used
|
|
||||||
together with the `switch` statement in order to determine which block should
|
|
||||||
be executed.
|
|
||||||
|
|
||||||
Each `case` command is given one or more parameters. The first `case`
|
Each `case` command is given one or more parameters. The first `case` command with a parameter that matches the string specified in the switch command will be evaluated. `case` parameters may contain wildcards. These need to be escaped or quoted in order to avoid regular wildcard expansion using filenames.
|
||||||
command with a parameter that matches the string specified in the
|
|
||||||
switch command will be evaluated. `case` parameters may contain
|
|
||||||
wildcards. These need to be escaped or quoted in order to avoid
|
|
||||||
regular wildcard expansion using filenames.
|
|
||||||
|
|
||||||
Note that fish does not fall through on case statements. Only the
|
Note that fish does not fall through on case statements. Only the first matching case is executed.
|
||||||
first matching case is executed.
|
|
||||||
|
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.
|
||||||
|
|
||||||
Note that command substitutions in a case statement will be
|
|
||||||
evaluated even if its body is not taken. All substitutions, including
|
|
||||||
command substitutions, must be performed before the value can be compared
|
|
||||||
against the parameter.
|
|
||||||
|
|
||||||
\subsection switch-example Example
|
\subsection switch-example Example
|
||||||
|
|
||||||
If the variable \$animal contains the name of an animal, the following
|
If the variable \$animal contains the name of an animal, the following code would attempt to classify it:
|
||||||
code would attempt to classify it:
|
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
switch $animal
|
switch $animal
|
||||||
|
@ -48,4 +37,3 @@ end
|
||||||
|
|
||||||
If the above code was run with `$animal` set to `whale`, the output
|
If the above code was run with `$animal` set to `whale`, the output
|
||||||
would be `mammal`.
|
would be `mammal`.
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,17 @@ and 1 if false. An expression is made up of one or more operators
|
||||||
and their arguments.
|
and their arguments.
|
||||||
|
|
||||||
The following operators are available to examine files and directories:
|
The following operators are available to examine files and directories:
|
||||||
|
|
||||||
- `-b FILE` returns true if `FILE` is a block device.
|
- `-b FILE` returns true if `FILE` is a block device.
|
||||||
|
|
||||||
- `-c FILE` returns true if `FILE` is a character device.
|
- `-c FILE` returns true if `FILE` is a character device.
|
||||||
|
|
||||||
- `-d FILE` returns true if `FILE` is a directory.
|
- `-d FILE` returns true if `FILE` is a directory.
|
||||||
|
|
||||||
- `-e FILE` returns true if `FILE` exists.
|
- `-e FILE` returns true if `FILE` exists.
|
||||||
|
|
||||||
- `-f FILE` returns true if `FILE` is a regular file.
|
- `-f FILE` returns true if `FILE` is a regular file.
|
||||||
|
|
||||||
- `-g FILE` returns true if `FILE` has the set-group-ID bit set.
|
- `-g FILE` returns true if `FILE` has the set-group-ID bit set.
|
||||||
- `-G FILE` returns true if `FILE` exists and has the same group ID
|
- `-G FILE` returns true if `FILE` exists and has the same group ID
|
||||||
as the current user.
|
as the current user.
|
||||||
|
@ -24,12 +30,19 @@ as the current user.
|
||||||
- `-O FILE` returns true if `FILE` exists and is owned by the current
|
- `-O FILE` returns true if `FILE` exists and is owned by the current
|
||||||
user.
|
user.
|
||||||
- `-p FILE` returns true if `FILE` is a named pipe.
|
- `-p FILE` returns true if `FILE` is a named pipe.
|
||||||
|
|
||||||
- `-r FILE` returns true if `FILE` is marked as readable.
|
- `-r FILE` returns true if `FILE` is marked as readable.
|
||||||
|
|
||||||
- `-s FILE` returns true if the size of `FILE` is greater than zero.
|
- `-s FILE` returns true if the size of `FILE` is greater than zero.
|
||||||
|
|
||||||
- `-S FILE` returns true if `FILE` is a socket.
|
- `-S FILE` returns true if `FILE` is a socket.
|
||||||
|
|
||||||
- `-t FD` returns true if the file descriptor `FD` is a terminal (TTY).
|
- `-t FD` returns true if the file descriptor `FD` is a terminal (TTY).
|
||||||
|
|
||||||
- `-u FILE` returns true if `FILE` has the set-user-ID bit set.
|
- `-u FILE` returns true if `FILE` has the set-user-ID bit set.
|
||||||
|
|
||||||
- `-w FILE` returns true if `FILE` is marked as writable; note that this does not check if the filesystem is read-only.
|
- `-w FILE` returns true if `FILE` is marked as writable; note that this does not check if the filesystem is read-only.
|
||||||
|
|
||||||
- `-x FILE` returns true if `FILE` is marked as executable.
|
- `-x FILE` returns true if `FILE` is marked as executable.
|
||||||
|
|
||||||
The following operators are available to compare and examine text strings:
|
The following operators are available to compare and examine text strings:
|
||||||
|
@ -38,14 +51,21 @@ The following operators are available to compare and examine text strings:
|
||||||
- `STRING1 != STRING2` returns true if the strings `STRING1` and
|
- `STRING1 != STRING2` returns true if the strings `STRING1` and
|
||||||
`STRING2` are not identical.
|
`STRING2` are not identical.
|
||||||
- `-n STRING` returns true if the length of `STRING` is non-zero.
|
- `-n STRING` returns true if the length of `STRING` is non-zero.
|
||||||
|
|
||||||
- `-z STRING` returns true if the length of `STRING` is zero.
|
- `-z STRING` returns true if the length of `STRING` is zero.
|
||||||
|
|
||||||
The following operators are available to compare and examine numbers:
|
The following operators are available to compare and examine numbers:
|
||||||
|
|
||||||
- `NUM1 -eq NUM2` returns true if `NUM1` and `NUM2` are numerically equal.
|
- `NUM1 -eq NUM2` returns true if `NUM1` and `NUM2` are numerically equal.
|
||||||
|
|
||||||
- `NUM1 -ne NUM2` returns true if `NUM1` and `NUM2` are not numerically equal.
|
- `NUM1 -ne NUM2` returns true if `NUM1` and `NUM2` are not numerically equal.
|
||||||
|
|
||||||
- `NUM1 -gt NUM2` returns true if `NUM1` is greater than `NUM2`.
|
- `NUM1 -gt NUM2` returns true if `NUM1` is greater than `NUM2`.
|
||||||
|
|
||||||
- `NUM1 -ge NUM2` returns true if `NUM1` is greater than or equal to `NUM2`.
|
- `NUM1 -ge NUM2` returns true if `NUM1` is greater than or equal to `NUM2`.
|
||||||
|
|
||||||
- `NUM1 -lt NUM2` returns true if `NUM1` is less than `NUM2`.
|
- `NUM1 -lt NUM2` returns true if `NUM1` is less than `NUM2`.
|
||||||
|
|
||||||
- `NUM1 -le NUM2` returns true if `NUM1` is less than or equal to `NUM2`.
|
- `NUM1 -le NUM2` returns true if `NUM1` is less than or equal to `NUM2`.
|
||||||
|
|
||||||
Note that only integers are supported. For more complex mathematical
|
Note that only integers are supported. For more complex mathematical
|
||||||
|
@ -53,7 +73,9 @@ operations, including fractions, the `env` program may be useful. Consult the
|
||||||
documentation for your operating system.
|
documentation for your operating system.
|
||||||
|
|
||||||
Expressions can be combined using the following operators:
|
Expressions can be combined using the following operators:
|
||||||
|
|
||||||
- `COND1 -a COND2` returns true if both `COND1` and `COND2` are true.
|
- `COND1 -a COND2` returns true if both `COND1` and `COND2` are true.
|
||||||
|
|
||||||
- `COND1 -o COND2` returns true if either `COND1` or `COND2` are true.
|
- `COND1 -o COND2` returns true if either `COND1` or `COND2` are true.
|
||||||
|
|
||||||
Expressions can be inverted using the `!` operator:
|
Expressions can be inverted using the `!` operator:
|
||||||
|
@ -61,6 +83,7 @@ Expressions can be inverted using the `!` operator:
|
||||||
`EXPRESSION` is true.
|
`EXPRESSION` is true.
|
||||||
|
|
||||||
Expressions can be grouped using parentheses.
|
Expressions can be grouped using parentheses.
|
||||||
|
|
||||||
- `( EXPRESSION )` returns the value of `EXPRESSION`.
|
- `( EXPRESSION )` returns the value of `EXPRESSION`.
|
||||||
Note that parentheses will usually require escaping with `\\(` to avoid
|
Note that parentheses will usually require escaping with `\\(` to avoid
|
||||||
being interpreted as a command substitution.
|
being interpreted as a command substitution.
|
||||||
|
@ -95,6 +118,7 @@ if test \( -f /foo -o -f /bar \) -a \( -f /baz -o -f /bat \)
|
||||||
end.
|
end.
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
\subsection test-standards Standards
|
\subsection test-standards Standards
|
||||||
|
|
||||||
`test` implements a subset of the
|
`test` implements a subset of the
|
||||||
|
|
|
@ -7,39 +7,32 @@ trap [OPTIONS] [[ARG] SIGSPEC ... ]
|
||||||
|
|
||||||
\subsection trap-description Description
|
\subsection trap-description Description
|
||||||
|
|
||||||
`trap` is a wrapper around the fish event delivery
|
`trap` is a wrapper around the fish event delivery framework. It exists for backwards compatibility with POSIX shells. For other uses, it is recommended to define an <a href='index.html#event'>event handler</a>.
|
||||||
framework. It exists for backwards compatibility with POSIX
|
|
||||||
shells. For other uses, it is recommended to define an <a
|
|
||||||
href='index.html#event'>event handler</a>.
|
|
||||||
|
|
||||||
The following parameters are available:
|
The following parameters are available:
|
||||||
|
|
||||||
- `ARG` is the command to be executed on signal delivery.
|
- `ARG` is the command to be executed on signal delivery.
|
||||||
|
|
||||||
- `SIGSPEC` is the name of the signal to trap.
|
- `SIGSPEC` is the name of the signal to trap.
|
||||||
|
|
||||||
- `-h` or `--help` displays help and exits.
|
- `-h` or `--help` displays help and exits.
|
||||||
|
|
||||||
- `-l` or `--list-signals` prints a list of signal names.
|
- `-l` or `--list-signals` prints a list of signal names.
|
||||||
|
|
||||||
- `-p` or `--print` prints all defined signal handlers.
|
- `-p` or `--print` prints all defined signal handlers.
|
||||||
|
|
||||||
If `ARG` and `SIGSPEC` are both specified, `ARG` is the command to be
|
If `ARG` and `SIGSPEC` are both specified, `ARG` is the command to be executed when the signal specified by `SIGSPEC` is delivered.
|
||||||
executed when the signal specified by `SIGSPEC` is delivered.
|
|
||||||
|
|
||||||
If `ARG` is absent (and there is a single SIGSPEC) or -, each specified
|
If `ARG` is absent (and there is a single SIGSPEC) or -, each specified signal is reset to its original disposition (the value it had upon entrance to the shell). If `ARG` is the null string the signal specified by each `SIGSPEC` is ignored by the shell and by the commands it invokes.
|
||||||
signal is reset to its original disposition (the value it had upon
|
|
||||||
entrance to the shell). If `ARG` is the null string the signal
|
|
||||||
specified by each `SIGSPEC` is ignored by the shell and by the commands
|
|
||||||
it invokes.
|
|
||||||
|
|
||||||
If `ARG` is not present and `-p` has been supplied, then the trap commands
|
If `ARG` is not present and `-p` has been supplied, then the trap commands associated with each `SIGSPEC` are displayed. If no arguments are supplied or if only `-p` is given, `trap` prints the list of commands associated with each signal.
|
||||||
associated with each `SIGSPEC` are displayed. If no arguments are
|
|
||||||
supplied or if only `-p` is given, `trap` prints the list of commands
|
|
||||||
associated with each signal.
|
|
||||||
|
|
||||||
Signal names are case insensitive and the `SIG` prefix is optional.
|
Signal names are case insensitive and the `SIG` prefix is optional.
|
||||||
|
|
||||||
The return status is 1 if any `SIGSPEC` is invalid; otherwise trap
|
The return status is 1 if any `SIGSPEC` is invalid; otherwise trap returns 0.
|
||||||
returns 0.
|
|
||||||
|
|
||||||
\subsection trap-example Example
|
\subsection trap-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
trap "status --print-stack-trace" SIGUSR1
|
trap "status --print-stack-trace" SIGUSR1
|
||||||
# Prints a stack trace each time the SIGUSR1 signal is sent to the shell.
|
# Prints a stack trace each time the SIGUSR1 signal is sent to the shell.
|
||||||
|
|
|
@ -5,27 +5,49 @@
|
||||||
<div class="menu tutorial_menu">
|
<div class="menu tutorial_menu">
|
||||||
\endhtmlonly
|
\endhtmlonly
|
||||||
- <a href="#tut_why_fish">Why fish?</a>
|
- <a href="#tut_why_fish">Why fish?</a>
|
||||||
|
|
||||||
- <a href="#tut_learning_Fish">Learning fish</a>
|
- <a href="#tut_learning_Fish">Learning fish</a>
|
||||||
|
|
||||||
- <a href="#tut_running_commands">Running Commands</a>
|
- <a href="#tut_running_commands">Running Commands</a>
|
||||||
|
|
||||||
- <a href="#tut_getting_help">Getting Help</a>
|
- <a href="#tut_getting_help">Getting Help</a>
|
||||||
|
|
||||||
- <a href="#tut_syntax_highlighting">Syntax Highlighting</a>
|
- <a href="#tut_syntax_highlighting">Syntax Highlighting</a>
|
||||||
|
|
||||||
- <a href="#tut_wildcards">Wildcards</a>
|
- <a href="#tut_wildcards">Wildcards</a>
|
||||||
|
|
||||||
- <a href="#tut_pipes_and_redirections">Pipes and Redirections</a>
|
- <a href="#tut_pipes_and_redirections">Pipes and Redirections</a>
|
||||||
|
|
||||||
- <a href="#tut_autosuggestions">Autosuggestions</a>
|
- <a href="#tut_autosuggestions">Autosuggestions</a>
|
||||||
|
|
||||||
- <a href="#tut_tab_completions">Tab Completions</a>
|
- <a href="#tut_tab_completions">Tab Completions</a>
|
||||||
|
|
||||||
- <a href="#tut_variables">Variables</a>
|
- <a href="#tut_variables">Variables</a>
|
||||||
|
|
||||||
- <a href="#tut_exit_status">Exit Status</a>
|
- <a href="#tut_exit_status">Exit Status</a>
|
||||||
|
|
||||||
- <a href="#tut_exports">Shell Variables</a>
|
- <a href="#tut_exports">Shell Variables</a>
|
||||||
|
|
||||||
- <a href="#tut_lists">Lists</a>
|
- <a href="#tut_lists">Lists</a>
|
||||||
|
|
||||||
- <a href="#tut_command_substitutions">Command Substitutions</a>
|
- <a href="#tut_command_substitutions">Command Substitutions</a>
|
||||||
|
|
||||||
- <a href="#tut_combiners">Combiners (And, Or, Not)</a>
|
- <a href="#tut_combiners">Combiners (And, Or, Not)</a>
|
||||||
|
|
||||||
- <a href="#tut_conditionals">Conditionals (If, Else, Switch)</a>
|
- <a href="#tut_conditionals">Conditionals (If, Else, Switch)</a>
|
||||||
|
|
||||||
- <a href="#tut_functions">Functions</a>
|
- <a href="#tut_functions">Functions</a>
|
||||||
|
|
||||||
- <a href="#tut_loops">Loops</a>
|
- <a href="#tut_loops">Loops</a>
|
||||||
|
|
||||||
- <a href="#tut_prompt">Prompt</a>
|
- <a href="#tut_prompt">Prompt</a>
|
||||||
|
|
||||||
- <a href="#tut_path">$PATH</a>
|
- <a href="#tut_path">$PATH</a>
|
||||||
|
|
||||||
- <a href="#tut_startup">Startup</a>
|
- <a href="#tut_startup">Startup</a>
|
||||||
|
|
||||||
- <a href="#tut_autoload">Autoloading Functions</a>
|
- <a href="#tut_autoload">Autoloading Functions</a>
|
||||||
|
|
||||||
- <a href="#tut-more">Ready for more?</a>
|
- <a href="#tut-more">Ready for more?</a>
|
||||||
|
|
||||||
\htmlonly[block]
|
\htmlonly[block]
|
||||||
|
|
|
@ -19,10 +19,11 @@ The following options are available:
|
||||||
- \c -P or \c --force-path returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the <tt>$PATH</tt>.
|
- \c -P or \c --force-path returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the <tt>$PATH</tt>.
|
||||||
- \c -q or \c --quiet suppresses all output; this is useful when testing the exit status.
|
- \c -q or \c --quiet suppresses all output; this is useful when testing the exit status.
|
||||||
|
|
||||||
`type` sets the exit status to 0 if the specified command was found,
|
`type` sets the exit status to 0 if the specified command was found, and 1 if it could not be found.
|
||||||
and 1 if it could not be found.
|
|
||||||
|
|
||||||
\subsection type-example Example
|
\subsection type-example Example
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
type fg
|
type fg
|
||||||
# Outputs the string 'fg is a shell builtin'.
|
# Outputs the string 'fg is a shell builtin'.
|
||||||
|
|
|
@ -7,61 +7,59 @@ ulimit [OPTIONS] [LIMIT]
|
||||||
|
|
||||||
\subsection ulimit-description Description
|
\subsection ulimit-description Description
|
||||||
|
|
||||||
`ulimit` builtin sets or outputs the resource usage limits of the
|
`ulimit` builtin sets or outputs the resource usage limits of the shell and any processes spawned by it. If a new limit value is omitted, the current value of the limit of the resource is printed; otherwise, the specified limit is set to the new value.
|
||||||
shell and any processes spawned by it. If a new limit value is
|
|
||||||
omitted, the current value of the limit of the resource is printed; otherwise,
|
|
||||||
the specified limit is set to the new value.
|
|
||||||
|
|
||||||
Use one of the following switches to specify which resource limit to set or report:
|
Use one of the following switches to specify which resource limit to set or report:
|
||||||
|
|
||||||
- `-c` or `--core-size`: the maximum size of core files created. By setting this limit to zero, core dumps can be disabled.
|
- `-c` or `--core-size`: the maximum size of core files created. By setting this limit to zero, core dumps can be disabled.
|
||||||
|
|
||||||
- `-d` or `--data-size`: the maximum size of a process' data segment.
|
- `-d` or `--data-size`: the maximum size of a process' data segment.
|
||||||
|
|
||||||
- `-f` or `--file-size`: the maximum size of files created by the shell.
|
- `-f` or `--file-size`: the maximum size of files created by the shell.
|
||||||
|
|
||||||
- `-l` or `--lock-size`: the maximum size that may be locked into memory.
|
- `-l` or `--lock-size`: the maximum size that may be locked into memory.
|
||||||
|
|
||||||
- `-m` or `--resident-set-size`: the maximum resident set size.
|
- `-m` or `--resident-set-size`: the maximum resident set size.
|
||||||
|
|
||||||
- `-n` or `--file-descriptor-count`: the maximum number of open file descriptors (most systems do not allow this value to be set).
|
- `-n` or `--file-descriptor-count`: the maximum number of open file descriptors (most systems do not allow this value to be set).
|
||||||
|
|
||||||
- `-s` or `--stack-size`: the maximum stack size.
|
- `-s` or `--stack-size`: the maximum stack size.
|
||||||
|
|
||||||
- `-t` or `--cpu-time`: the maximum amount of CPU time in seconds.
|
- `-t` or `--cpu-time`: the maximum amount of CPU time in seconds.
|
||||||
|
|
||||||
- `-u` or `--process-count`: the maximum number of processes available to a single user.
|
- `-u` or `--process-count`: the maximum number of processes available to a single user.
|
||||||
|
|
||||||
- `-v` or `--virtual-memory-size` The maximum amount of virtual memory available to the shell.
|
- `-v` or `--virtual-memory-size` The maximum amount of virtual memory available to the shell.
|
||||||
|
|
||||||
Note that not all these limits are available in all operating systems.
|
Note that not all these limits are available in all operating systems.
|
||||||
|
|
||||||
The value of limit can be a number in the unit specified for
|
The value of limit can be a number in the unit specified for the resource or one of the special values `hard`, `soft`, or `unlimited`, which stand for the current hard limit, the current soft limit, and no limit, respectively.
|
||||||
the resource or one of the special values `hard`, `soft`, or `unlimited`,
|
|
||||||
which stand for the current hard limit, the current soft limit, and no
|
|
||||||
limit, respectively.
|
|
||||||
|
|
||||||
If limit is given, it is the new value of the specified resource. If
|
If limit is given, it is the new value of the specified resource. If no option is given, then `-f` is assumed. Values are in kilobytes, except for `-t`, which is in seconds and `-n` and `-u`, which are unscaled values. The return status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit.
|
||||||
no option is given, then `-f` is assumed. Values are in kilobytes,
|
|
||||||
except for `-t`, which is in seconds and `-n` and `-u`, which are unscaled
|
|
||||||
values. The return status is 0 unless an invalid option or argument is
|
|
||||||
supplied, or an error occurs while setting a new limit.
|
|
||||||
|
|
||||||
`ulimit` also accepts the following switches that determine what type of
|
`ulimit` also accepts the following switches that determine what type of limit to set:
|
||||||
limit to set:
|
|
||||||
|
|
||||||
- `-H` or `--hard` sets hard resource limit
|
- `-H` or `--hard` sets hard resource limit
|
||||||
|
|
||||||
- `-S` or `--soft` sets soft resource limit
|
- `-S` or `--soft` sets soft resource limit
|
||||||
|
|
||||||
A hard limit can only be decreased. Once it is set it cannot be
|
A hard limit can only be decreased. Once it is set it cannot be increased; a soft limit may be increased up to the value of the hard limit. If neither -H nor -S is specified, both the soft and hard limits are updated when assigning a new limit value, and the soft limit is used when reporting the current value.
|
||||||
increased; a soft limit may be increased up to the value of the hard
|
|
||||||
limit. If neither -H nor -S is specified, both the soft and hard
|
|
||||||
limits are updated when assigning a new limit value, and the soft
|
|
||||||
limit is used when reporting the current value.
|
|
||||||
|
|
||||||
The following additional options are also understood by `ulimit`:
|
The following additional options are also understood by `ulimit`:
|
||||||
|
|
||||||
- `-a` or `--all` prints all current limits
|
- `-a` or `--all` prints all current limits
|
||||||
|
|
||||||
- `-h` or `--help` displays help and exits.
|
- `-h` or `--help` displays help and exits.
|
||||||
|
|
||||||
The `fish` implementation of `ulimit` should behave identically to the
|
The `fish` implementation of `ulimit` should behave identically to the implementation in bash, except for these differences:
|
||||||
implementation in bash, except for these differences:
|
|
||||||
|
|
||||||
- Fish `ulimit` supports GNU-style long options for all switches
|
- Fish `ulimit` supports GNU-style long options for all switches
|
||||||
|
|
||||||
- Fish `ulimit` does not support the `-p` option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because it this method of determining pipe size is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
|
- Fish `ulimit` does not support the `-p` option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because it this method of determining pipe size is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
|
||||||
|
|
||||||
- Fish `ulimit` does not support getting or setting multiple limits in one command, except reporting all values using the -a switch
|
- Fish `ulimit` does not support getting or setting multiple limits in one command, except reporting all values using the -a switch
|
||||||
|
|
||||||
|
|
||||||
\subsection ulimit-example Example
|
\subsection ulimit-example Example
|
||||||
|
|
||||||
`ulimit -Hs 64` sets the hard stack size limit to 64 kB.
|
`ulimit -Hs 64` sets the hard stack size limit to 64 kB.
|
||||||
|
|
|
@ -7,54 +7,35 @@ umask [OPTIONS] [MASK]
|
||||||
|
|
||||||
\subsection umask-description Description
|
\subsection umask-description Description
|
||||||
|
|
||||||
`umask` displays and manipulates the "umask", or file creation mode mask,
|
`umask` displays and manipulates the "umask", or file creation mode mask, which is used to restrict the default access to files.
|
||||||
which is used to restrict the default access to files.
|
|
||||||
|
|
||||||
The umask may be expressed either as an octal number, which represents
|
The umask may be expressed either as an octal number, which represents the rights that will be removed by default, or symbolically, which represents the only rights that will be granted by default.
|
||||||
the rights that will be removed by default, or symbolically, which represents
|
|
||||||
the only rights that will be granted by default.
|
|
||||||
|
|
||||||
Access rights are explained in the manual page for the `chmod`(1) program.
|
Access rights are explained in the manual page for the `chmod`(1) program.
|
||||||
|
|
||||||
With no parameters, the current file creation mode mask is printed as
|
With no parameters, the current file creation mode mask is printed as an octal number.
|
||||||
an octal number.
|
|
||||||
|
|
||||||
- `-h` or `--help` prints this message.
|
- `-h` or `--help` prints this message.
|
||||||
|
|
||||||
- `-S` or `--symbolic` prints the umask in symbolic form instead of octal form.
|
- `-S` or `--symbolic` prints the umask in symbolic form instead of octal form.
|
||||||
|
|
||||||
- `-p` or `--as-command` outputs the umask in a form that may be reused as input
|
- `-p` or `--as-command` outputs the umask in a form that may be reused as input
|
||||||
|
|
||||||
If a numeric mask is specified as a parameter, the current shell's umask
|
If a numeric mask is specified as a parameter, the current shell's umask will be set to that value, and the rights specified by that mask will be removed from new files and directories by default.
|
||||||
will be set to that value, and the rights specified by that mask will be
|
|
||||||
removed from new files and directories by default.
|
|
||||||
|
|
||||||
If a symbolic mask is specified, the desired permission bits, and
|
If a symbolic mask is specified, the desired permission bits, and not the inverse, should be specified. A symbolic mask is a comma separated list of rights. Each right consists of three parts:
|
||||||
not the inverse, should be specified. A symbolic mask is a comma
|
|
||||||
separated list of rights. Each right consists of three parts:
|
|
||||||
|
|
||||||
- The first part specifies to whom this set of right applies, and can
|
- The first part specifies to whom this set of right applies, and can be one of `u`, `g`, `o` or `a`, where `u` specifies the user who owns the file, `g` specifies the group owner of the file, `o` specific other users rights and `a` specifies all three should be changed.
|
||||||
be one of `u`, `g`, `o` or `a`, where `u` specifies the user who
|
|
||||||
owns the file, `g` specifies the group owner of the file, `o`
|
|
||||||
specific other users rights and `a` specifies all three should be
|
|
||||||
changed.
|
|
||||||
- The second part of a right specifies the mode, and can be one of \c
|
|
||||||
=, `+` or `-`, where `=` specifies that the rights should be set to
|
|
||||||
the new value, `+` specifies that the specified right should be added
|
|
||||||
to those previously specified and `-` specifies that the specified
|
|
||||||
rights should be removed from those previously specified.
|
|
||||||
- The third part of a right specifies what rights should be changed
|
|
||||||
and can be any combination of `r`, `w` and `x`, representing
|
|
||||||
read, write and execute rights.
|
|
||||||
|
|
||||||
If the first and second parts are skipped, they are assumed to be `a`
|
- The second part of a right specifies the mode, and can be one of `=`, `+` or `-`, where `=` specifies that the rights should be set to the new value, `+` specifies that the specified right should be added to those previously specified and `-` specifies that the specified rights should be removed from those previously specified.
|
||||||
and `=`, respectively. As an example, `r,u+w` means all
|
|
||||||
users should have read access and the file owner should also have
|
- The third part of a right specifies what rights should be changed and can be any combination of `r`, `w` and `x`, representing read, write and execute rights.
|
||||||
write access.
|
|
||||||
|
If the first and second parts are skipped, they are assumed to be `a` and `=`, respectively. As an example, `r,u+w` means all users should have read access and the file owner should also have write access.
|
||||||
|
|
||||||
Note that symbolic masks currently do not work as intended.
|
Note that symbolic masks currently do not work as intended.
|
||||||
|
|
||||||
|
|
||||||
\subsection umask-example Example
|
\subsection umask-example Example
|
||||||
|
|
||||||
`umask 177` or `umask u=rw` sets the file
|
`umask 177` or `umask u=rw` sets the file creation mask to read and write for the owner and no permissions at all for any other users.
|
||||||
creation mask to read and write for the owner and no permissions at
|
|
||||||
all for any other users.
|
|
||||||
|
|
||||||
|
|
|
@ -64,13 +64,14 @@ body {
|
||||||
.fish_right_big { margin-left: 200px; }
|
.fish_right_big { margin-left: 200px; }
|
||||||
.fish_only_bar {
|
.fish_only_bar {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-bottom: 3rem;
|
||||||
}
|
}
|
||||||
hr {
|
hr {
|
||||||
height: 0;
|
height: 0;
|
||||||
border: none;
|
border: none;
|
||||||
border-top: 1px solid #AAA;
|
border-top: 1px solid #AAA;
|
||||||
}
|
}
|
||||||
/*Ineraction*/
|
/*Interaction*/
|
||||||
a { color: #3d5cb3; }
|
a { color: #3d5cb3; }
|
||||||
.qindex a {
|
.qindex a {
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -7,9 +7,8 @@ vared VARIABLE_NAME
|
||||||
|
|
||||||
\subsection vared-description Description
|
\subsection vared-description Description
|
||||||
|
|
||||||
`vared` is used to interactively edit the value of an environment
|
`vared` is used to interactively edit the value of an environment variable. Array variables as a whole can not be edited using `vared`, but individual array elements can.
|
||||||
variable. Array variables as a whole can not be edited using `vared`,
|
|
||||||
but individual array elements can.
|
|
||||||
|
|
||||||
\subsection vared-example Example
|
\subsection vared-example Example
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,13 @@ while CONDITION; COMMANDS...; end
|
||||||
\endfish
|
\endfish
|
||||||
|
|
||||||
\subsection while-description Description
|
\subsection while-description Description
|
||||||
`while` repeatedly executes `CONDITION`, and if the exit status
|
|
||||||
is 0, then executes `COMMANDS`.
|
|
||||||
|
|
||||||
If the exit status of `CONDITION` is non-zero on the first iteration,
|
`while` repeatedly executes `CONDITION`, and if the exit status is 0, then executes `COMMANDS`.
|
||||||
`COMMANDS` will not be executed at all.
|
|
||||||
|
If the exit status of `CONDITION` is non-zero on the first iteration, `COMMANDS` will not be executed at all.
|
||||||
|
|
||||||
|
Use <a href="#begin">`begin; ...; end`</a> for complex conditions; more complex control can be achieved with `while true` containing a <a href="#break">break</a>.
|
||||||
|
|
||||||
Use <a href="#begin">`begin; ...; end`</a> for complex conditions; more
|
|
||||||
complex control can be achieved with `while true` containing a
|
|
||||||
<a href="#break">break</a>.
|
|
||||||
|
|
||||||
\subsection while-example Example
|
\subsection while-example Example
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue