+- To redirect output of FD number N, write N\>DESTINATION
+- To redirect output of FD number N to a file which will be appended, write N\>\>DESTINATION_FILE
-Example: echo Hello 2\>- and echo Hello ^- are
+Example: echo Hello 2\>-
and echo Hello ^-
are
equivalent.
\subsection piping Piping
@@ -168,7 +169,7 @@ pipeline. This means that the standard output of one command will be read
in as standard input into the next command. This is done by separating
the commands by the pipe character (|). For example
-cat foo.txt | head
+cat foo.txt | head
will call the 'cat' program with the parameter 'foo.txt', which will
print the contents of the file 'foo.txt'. The contents of foo.txt will
@@ -176,7 +177,7 @@ then be filtered through the program 'head', which will pass on the
first ten lines of the file to the screen. For more information on how
to combine commands through pipes, read the manual pages of the
commands you want to use using the 'man' command. If you want to find
-out more about the 'cat' program, type man cat.
+out more about the 'cat' program, type man cat
.
Pipes usually connect file descriptor 1 (standard output) of the first
process to file descriptor 0 (standard input) of the second
@@ -184,7 +185,7 @@ process. It is possible use a different output file descriptor by
prepending the desired FD number and then output redirect symbol to
the pipe. For example:
-make fish 2>|less
+make fish 2>|less
will attempt to build the fish program, and any errors will be shown
using the less pager.
@@ -199,7 +200,6 @@ your command. This will tell fish to run the job in the background.
\subsection syntax-job-control Job control
-
Most programs allow you to suspend the programs execution and return
control to \c fish by Pressing ^Z (Press and hold the Control key and
press 'z'). Once back at the \c fish commandline, you can start other
@@ -219,7 +219,7 @@ href="builtins.html#jobs">jobs command.
This is a short explanation of some of the commonly used words in fish.
- argument, a parameter given to a command
-- builtin, a command that is implemented as part of the shell
+- builtin, a command that is implemented in the shell
- command, a program
- function, a block of one or more fish commands that can be called as a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
- job, a running pipeline or command
@@ -229,14 +229,14 @@ This is a short explanation of some of the commonly used words in fish.
\section help Help
\c fish has an extensive help system. Use the help command to obtain help on
-a specific subject or command. For instance, writing help
-syntax displays the syntax section of this
+href="commands.html#help">help
command to obtain help on
+a specific subject or command. For instance, writing help
+syntax
displays the syntax section of this
documentation.
-Help on a specific builtin can also be obtained with the -h
+Help on a specific builtin can also be obtained with the -h
parameter. For instance, to obtain help on the \c fg builtin, either
-type fg -h or help fg.
+type fg -h
or help fg
.
\section completion Tab completion
@@ -282,11 +282,11 @@ Specifying your own completions is not complicated. To specify a
completion, use the \c complete command. \c complete takes
as a parameter the name of the command to specify a completion
for. For example, to add a completion for the program \c myprog, one
-would start the completion command with complete -c myprog
-.... To provide a list of possible completions for myprog, use
+would start the completion command with complete -c myprog
+...
. To provide a list of possible completions for myprog, use
the \c -a switch. If \c myprog accepts the arguments start and stop,
-this can be specified as complete -c myprog -a 'start
-stop'. The argument to the \c -a switch is always a single
+this can be specified as complete -c myprog -a 'start
+stop'
. The argument to the \c -a switch is always a single
string. At completion time, it will be tokenized on spaces and tabs,
and variable expansion, command substitution and other forms of
parameter expansion will take place.
@@ -299,7 +299,7 @@ respectively. If the command 'myprog' has an option '-o' which can
also be written as '--output', and which can take an additional value
of either 'yes' or 'no', this can be specified by writing:
-complete -c myprog -s o -l output -a "yes no"
+complete -c myprog -s o -l output -a "yes no"
There are also special switches for specifying that a switch requires
an argument, to disable filename completion, to create completions
@@ -359,8 +359,8 @@ Example:
The command echo (basename image.jpg .jpg).png
will
output 'image.png'.
-The command for i in *.jpg; convert $i (basename $i .jpg).png;
-end will convert all Jpeg files in the current directory to the
+The command for i in *.jpg; convert $i (basename $i .jpg).png;
+end
will convert all Jpeg files in the current directory to the
PNG format.
@@ -371,9 +371,9 @@ expanded so each element of the list becomes a new parameter.
Example:
-echo input.{c,h,txt} outputs 'input.c input.h input.txt'
+echo input.{c,h,txt}
outputs 'input.c input.h input.txt'
-The command mv *.{c,h} src/ moves all files with the suffix
+The command mv *.{c,h} src/
moves all files with the suffix
'.c' or '.h' to the subdirectory src.
\subsection expand-variable Variable expansion
@@ -385,12 +385,12 @@ href="#variables"> Environment variables section.
Example:
- echo \$HOME prints the home directory of the current
+ echo \$HOME
prints the home directory of the current
user.
If you wish to combine environment variables with text, you can
encase the variables within braces to embed a variable inside running
-text like echo Konnichiwa {$USER}san, which will print a
+text like echo Konnichiwa {$USER}san
, which will print a
personalized Japanese greeting.
The {$USER}san syntax might need a bit of an elaboration. Posix
@@ -451,11 +451,11 @@ take the process ids as an argument.
Example:
-fg \%ema will search for a process whose command line begins
+fg \%ema
will search for a process whose command line begins
with the letters 'ema', such as emacs, and if found, put it in the
foreground.
-kill -s SIGINT \%3 will send the SIGINT signal to the job
+kill -s SIGINT \%3
will send the SIGINT signal to the job
with job id 3.
\subsection combine Combining different expansions
@@ -467,7 +467,7 @@ created.
Example:
If the current directory contains the files 'foo' and 'bar', the command
-echo a(ls){1,2,3}
+echo a(ls){1,2,3}
will output 'abar1 abar2 abar3 afoo1 afoo2 afoo3'.
@@ -485,7 +485,7 @@ command.
Example:
To set the variable \c smurf to the value \c blue, use the command
-set smurf blue.
+set smurf blue
.
After a variable has been set, you can use the value of a variable in
the shell through variable expansion.
@@ -493,8 +493,8 @@ the shell through variable expansion.
Example:
To use the value of a the variable \c smurf, write $ (dollar symbol)
-followed by the name of the variable, like echo Smurfs are
-$smurf, which would print the result 'Smurfs are blue'.
+followed by the name of the variable, like echo Smurfs are
+$smurf
, which would print the result 'Smurfs are blue'.
\subsection variables-scope Variable scope
@@ -503,7 +503,7 @@ local variables. Universal variables are shared between all fish
sessions a user is running on one computer. Global variables are
specific to the current fish session, but are not associated with any
specific block scope, and will never be erased unless the user
-explicitly requests it using set -e. Local variables are
+explicitly requests it using set -e
. Local variables are
specific to the current fish session, and associated with a specific
block of commands, and is automatically erased when a specific block
goes out of scope. A block of commands is a series of commands that
@@ -550,8 +550,8 @@ value once, and it will be automatically updated for all sessions, and
preserved across computer reboots and login/logout.
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 \c fish_color_cwd is a universal
+side, and issue the following command in one of them set
+fish_color_cwd blue
. Since \c 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.
@@ -748,7 +748,7 @@ builtins or shellscript functions, and can only be used inside fish.
- umask, set or get the file creation mask
- while, perform a block of commands while a condition is met
-For more information about these commands, use the --help
+For more information about these commands, use the --help
option of the command to display a longer explanation.
\section editor Command Line editor
@@ -781,7 +781,7 @@ You can change these key bindings by making an inputrc file. To do
this, copy the file /etc/fish_inputrc to your home directory and
rename it to '.fish_inputrc'. Now you can edit the file .fish_inputrc,
to change your key bindings. The fileformat of this file is described
-in the manual page for readline. Use the command man readline
+in the manual page for readline. Use the command man readline
to read up on this syntax. Please note that the list of key binding
functions in fish is different to that offered by readline. Currently,
the following functions are available:
@@ -863,7 +863,7 @@ fish will be stopped until the program finishes. Sometimes this is not
desirable. For example, you may wish to start an application with a
graphical user interface from the terminal, and then be able to
continue using the shell. In such cases, there are several ways in
-which the user can change fish's behaviour.
+which the user can change fish
's behaviour.
-# By ending a command with the \& (ampersand) symbol, the user tells \c fish to put the specified command into the background. A background process will be run simultaneous with \c fish. \c fish will retain control of the terminal, so the program will not be able to read from the keyboard.
-# By pressing ^Z, the user stops a currently running foreground program and returns control to \c fish. Some programs do not support this feature, or remap it to another key. Gnu emacs uses ^X z to stop running.
@@ -875,13 +875,13 @@ On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you
installed fish in your home directory) and ~/.fish, in that order. If
you want to run a command only on starting an interactive shell, use
the exit status of the command 'status --is-interactive' to determine
-if the shell is interactive. If you want to run a command only on
-starting a login shell, use 'status --is-login' instead.
+if the shell is interactive. If you want to run a command only when
+using a login shell, use 'status --is-login' instead.
-Example:
+Examples:
If you want to add the directory ~/linux/bin to your PATH variable
-when loging in, add the following to your ~/.fish file:
+when using a login shell, add the following to your ~/.fish file:
if status --is-login
set PATH $PATH ~/linux/bin
@@ -891,7 +891,7 @@ If you want to run a set of commands when \c fish exits, use an event handler that is triggered by the exit of the
shell:
-function on_exit --on-process %self
+function on_exit --on-process \%self
echo fish is now exiting
end
@@ -1411,7 +1411,7 @@ between different shell sessions and applications.
The open command uses the mimetype database (Also used by both Gnome
or KDE) to launch the default application for a file. Just type
-open *.html and all the HTML files in your current directory
+open *.html
and all the HTML files in your current directory
will be opened in your default browser. No longer will you have to
convert your filenames to URLS, remember clunky Open Office command
names, worry about absolute paths or any the other common pitfalls when
@@ -1421,10 +1421,10 @@ opening files from the commandline.
\c fish is heavily commented. Both the source code and the
program in general features a great deal of easily accessible
-documentation. The help command is used to display HTML-based
-help files. Just type help and a subject, and the help system
+documentation. The help
command is used to display HTML-based
+help files. Just type help
and a subject, and the help system
will try to fill your needs. To view the page you are reading right
-now, you could simply type help difference. help
+now, you could simply type help difference
. help
also works great together with tab completion. Write \c help and
double tap on tab, a list of all help sections will be displayed, with
a description of the content of each section.
@@ -1475,9 +1475,9 @@ information.
\subsection difference-simple Simplicity
\c fish has a simple syntax. There is only one form of
-alias/function/whatever, accessed through the function
+alias/function/whatever, accessed through the function
builtin. The are very few builtins, \c fish relies on normal commands
-like echo, kill, printf and time
+like echo
, kill
, printf
and time
instead of reimplementing them as builtins.
Token separation is performed before variable expansion. This means
@@ -1485,13 +1485,13 @@ that even if a variable contains spaces, it will never be separated
into multiple arguments. If you want to tokenize a string, you can use
the tokenize command.
-Command substitution is specified using parenthesis, as in set name (whoami).
+Command substitution is specified using parenthesis, as in set name (whoami)
.
There is no math mode, use bc.
The POSIX way of setting variables is lame. Whitespace
sensitive languages are awful. "foo=bar" and "foo = bar" should not
-mean different things. \c fish uses a builtin, set to set and
+mean different things. \c fish uses a builtin, set
to set and
remove environment variables. While this may seem a bit obscure, this
makes for a very consistent language. In fish, everything, including
the loops, assignments and switch/case statements is a command.