mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 13:08:49 +00:00
Documentation update
Rework for Doxygen >1.8. Moved large parts of the documentation to a simplified format, making use of Markdown enhancements and fixing bad long options.
This commit is contained in:
parent
1c4223889b
commit
d282bc4625
86 changed files with 9212 additions and 4813 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -35,3 +35,13 @@ tests/foo.txt
|
|||
FISH-BUILD-VERSION-FILE
|
||||
version
|
||||
messages.pot
|
||||
|
||||
.editorconfig
|
||||
Fish-Shell.sublime-workspace
|
||||
Fish-Shell.sublime-project
|
||||
|
||||
doc_src/fish_lexicon_filter
|
||||
|
||||
lexicon.txt
|
||||
|
||||
debug-lexicon.log
|
||||
|
|
2425
Doxyfile.help
2425
Doxyfile.help
File diff suppressed because it is too large
Load diff
2367
Doxyfile.user
2367
Doxyfile.user
File diff suppressed because it is too large
Load diff
82
Makefile.in
82
Makefile.in
|
@ -148,6 +148,11 @@ HDR_FILES := $(HDR_FILES_SRC:.hdr.in=.hdr)
|
|||
|
||||
HELP_SRC := $(wildcard doc_src/*.txt)
|
||||
|
||||
#
|
||||
# HTML includes needed for HTML help
|
||||
#
|
||||
|
||||
HTML_SRC := doc_src/user_doc.header.html doc_src/user_doc.footer.html doc_src/user_doc.css
|
||||
|
||||
#
|
||||
# Files in the test directory
|
||||
|
@ -252,11 +257,20 @@ prof: all
|
|||
# Depend on the sources (*.hdr.in) and manually make the
|
||||
# intermediate *.hdr and doc.h files if needed
|
||||
# The sed command deletes everything including and after the first -, for simpler version numbers
|
||||
# Cleans up the user_doc/html directory once Doxygen is done.
|
||||
|
||||
user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC) doc.h $(HDR_FILES)
|
||||
(cat Doxyfile.user ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | sed "s/-.*//") | doxygen - && touch user_doc
|
||||
|
||||
user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) doc_src/fish_lexicon_filter
|
||||
(cat Doxyfile.user; echo INPUT_FILTER=doc_src/fish_lexicon_filter; \
|
||||
echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | sed "s/-.*//") | doxygen - && touch user_doc; \
|
||||
cd user_doc/html; rm -f bc_s.png bdwn.png closed.png ftv2*.png nav*.png open.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html
|
||||
|
||||
#
|
||||
# Build the help CSS files, using fish_lexicon_filter
|
||||
#
|
||||
doc_src/user_doc.css: doc_src/user_doc.css.in doc_src/fish_lexicon_filter
|
||||
-rm $@
|
||||
cd doc_src; \
|
||||
cat user_doc.css.in >> user_doc.css
|
||||
|
||||
#
|
||||
# Source code documentation. Also includes user documentation.
|
||||
|
@ -328,11 +342,70 @@ toc.txt: $(HDR_FILES:index.hdr=index.hdr.in)
|
|||
doc_src/index.hdr: toc.txt doc_src/index.hdr.in
|
||||
cat $@.in | awk '{if ($$0 ~ /@toc@/){ system("cat toc.txt");} else{ print $$0;}}' >$@
|
||||
|
||||
#
|
||||
# To enable the lexicon filter, we first need to be aware of what fish
|
||||
# considers to be a command, function, or external binary. We use
|
||||
# command_list_toc.txt for the base commands. Scan the share/functions
|
||||
# directory for other functions, some of which are mentioned in the docs, and
|
||||
# use /share/completions to find a good selection of binaries. Additionally,
|
||||
# colour defaults from __fish_config_interactive to set the docs colours when
|
||||
# used in a 'cli' style context.
|
||||
#
|
||||
|
||||
lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish
|
||||
-rm lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@
|
||||
# Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter.
|
||||
sed <command_list_toc.txt >>lexicon.tmp -n \
|
||||
-e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \
|
||||
-e "s|'\(.*\)'|cmnd \1|p"; mv lexicon_catalog.tmp lexicon_catalog.txt; \
|
||||
printf "%s\n" $(COMPLETIONS_DIR_FILES) | sed -n \
|
||||
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | sed >>lexicon.tmp -n \
|
||||
-e 'w lexicon_catalog.tmp' \
|
||||
-e "s|'\(.*\)'|sbin \1|p"; cat lexicon_catalog.tmp >> lexicon_catalog.txt; \
|
||||
printf "%s\n" $(FUNCTIONS_DIR_FILES) | sed -n \
|
||||
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | sed >>lexicon.tmp -n \
|
||||
-e 'w lexicon_catalog.tmp' \
|
||||
-e "s|'\(.*\)'|func \1|p"; \
|
||||
sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
|
||||
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p' \
|
||||
-e '$$G;s/.*\n/==end==/p'; \
|
||||
sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
|
||||
-e '1G;s/.*\n/==styles==/p' \
|
||||
-e '/set_default/s/.*fish_color\(_[a-z][a-z_]*\)/style\1/' \
|
||||
-e '/^style_/s/_\([^ ]*\) --\([^ ]*\).*$$/ \1 \2/p' \
|
||||
-e '/^style_/s/_\([^ ]* [^- ]*\) --\([^ ]*\).*$$/ \1 \2/p' \
|
||||
-e '/^style_/s/_\([^ ]* [^- ]*\).*$$/ \1/p'; \
|
||||
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
|
||||
|
||||
#
|
||||
# Compile Doxygen Input Filter from the lexicon. This is an executable sed
|
||||
# script as Doxygen opens it via popen()(3) Input (doc.h) is piped through and
|
||||
# matching words inside /fish../endfish blocks are marked up, contextually,
|
||||
# with custom Doxygen commands in the form of @word_type{content}. These are
|
||||
# trapped by ALIASES in the various Doxyfiles, allowing the content to be
|
||||
# transformed depending on output type (HTML, man page, developer docs). In
|
||||
# HTML, a style context can be applied through the /fish{style} block and
|
||||
# providing suitable CSS in user_doc.css.in
|
||||
#
|
||||
|
||||
doc_src/fish_lexicon_filter: lexicon.txt doc_src/fish_lexicon_filter.in
|
||||
-rm $@.tmp $@
|
||||
# Clean the filter input comments and set the shebang as sed can reside in
|
||||
# /bin or /usr/bin and some versions dont allow more than one comment!.
|
||||
sed <$@.in >$@.tmp -e 's|@sed@|'"`command -v sed`"'|' -e '/^[ ]*#[^!]/d'
|
||||
# Scan through the lexicon, transforming each line to something usefue to Doxygen.
|
||||
sed <lexicon.txt >>$@.tmp -n \
|
||||
-e 's|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,[[:<:]]\2[[:>:]],@\1{\2},g|p' \
|
||||
-e '/==end==/G;s/.*\n/b tidy/p' \
|
||||
-e '/==styles==/G;s/.*\n/:styles/p' \
|
||||
-e 's|^\(style [^ ]*\) \(.*\)$$|s,\1,\2,|p' \
|
||||
-e '$$G;s/.*\n/b processstyle/p'; \
|
||||
mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi
|
||||
|
||||
#
|
||||
# doc.h is a compilation of the various snipptes of text used both for
|
||||
# the user documentation and for internal help functions into a single
|
||||
# file that can be parsed dy Doxygen to generate the user
|
||||
# file that can be parsed by Doxygen to generate the user
|
||||
# documentation.
|
||||
#
|
||||
|
||||
|
@ -748,6 +821,7 @@ clean:
|
|||
rm -f $(PROGRAMS) fish_tests key_reader
|
||||
rm -f command_list.txt command_list_toc.txt toc.txt
|
||||
rm -f doc_src/index.hdr doc_src/commands.hdr
|
||||
rm -f doc_src/fish_lexicon_filter lexicon.txt doc_src/user_doc.css
|
||||
rm -f FISH-BUILD-VERSION-FILE
|
||||
if test "$(HAVE_DOXYGEN)" = 1; then \
|
||||
rm -rf doc user_doc share/man; \
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
\section alias alias - create a function
|
||||
|
||||
\subsection alias-synopsis Synopsis
|
||||
<pre>alias NAME DEFINITION
|
||||
alias NAME=DEFINITION</pre>
|
||||
\fish{syn}
|
||||
alias NAME DEFINITION
|
||||
alias NAME=DEFINITION
|
||||
\endfish
|
||||
|
||||
\subsection alias-description Description
|
||||
|
||||
\c alias is a simple wrapper for the \c function builtin.
|
||||
It exists for backwards compatibility with Posix
|
||||
shells. For other uses, it is recommended to define a <a
|
||||
href='#function'>function</a>.
|
||||
`alias` is a simple wrapper for the `function` builtin. It exists for backwards compatibility with Posix shells. For other uses, it is recommended to define a <a href='#function'>function</a>.
|
||||
|
||||
\c fish does not keep track of which functions have been defined using
|
||||
\c alias. They must be erased using <code>functions -e</code>.
|
||||
`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
|
||||
- DEFINITION is the actual command to execute. The string " $argv" will be appended.
|
||||
- `NAME` is the name of the alias
|
||||
- `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.
|
||||
|
||||
\subsection alias-example Example
|
||||
|
||||
The following code will create \c rmi, which runs \c rm with additional
|
||||
arguments on every invocation.
|
||||
The following code will create `rmi`, which runs `rm` with additional arguments on every invocation.
|
||||
|
||||
<code>alias rmi "rm -i"</code>
|
||||
\fish
|
||||
alias rmi "rm -i"
|
||||
\endfish
|
||||
|
||||
This is equivalent to entering the following function:
|
||||
|
||||
<pre>function rmi
|
||||
\fish
|
||||
function rmi
|
||||
rm -i $argv
|
||||
end</pre>
|
||||
|
||||
end
|
||||
\endfish
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
\section and and - conditionally execute a command
|
||||
|
||||
\subsection and-synopsis Synopsis
|
||||
<tt>COMMAND1; and COMMAND2</tt>
|
||||
\fish{syn}
|
||||
COMMAND1; and COMMAND2
|
||||
\endfish
|
||||
|
||||
\subsection and-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
\c 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
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
|
@ -16,12 +18,12 @@ variable.
|
|||
|
||||
\subsection and-example Example
|
||||
|
||||
The following code runs the \c make command to build a program. If the
|
||||
build succeeds, <code>make</code>'s exit status is 0, and the program is installed. If either step fails,
|
||||
the exit status is 1, and <tt>make clean</tt> is run, which removes the files created by 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.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
make; and make install; or make clean
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
BIN
doc_src/ascii_fish.png
Normal file
BIN
doc_src/ascii_fish.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
|
@ -1,22 +1,23 @@
|
|||
\section begin begin - start a new block of code
|
||||
|
||||
\subsection begin-synopsis Synopsis
|
||||
<tt>begin; [COMMANDS...;] end</tt>
|
||||
\fish{syn}
|
||||
begin; [COMMANDS...;] end
|
||||
\endfish
|
||||
|
||||
\subsection begin-description Description
|
||||
|
||||
\c 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. <code>begin; ...; end</tt> is equivalent
|
||||
to <tt>if true; ...; end</tt>.
|
||||
The block is unconditionally executed. `begin; ...; end` is equivalent
|
||||
to `if true; ...; end`.
|
||||
|
||||
\c 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 \c and.
|
||||
using the conditional commands like `and`.
|
||||
|
||||
\c begin does not change the current exit status.
|
||||
`begin` does not change the current exit status.
|
||||
|
||||
\subsection begin-example Example
|
||||
|
||||
|
@ -24,26 +25,26 @@ 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.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
begin
|
||||
set -l PIRATE Yarrr
|
||||
...
|
||||
set -l PIRATE Yarrr
|
||||
...
|
||||
end
|
||||
|
||||
echo $PIRATE
|
||||
# This will not output anything, since the PIRATE variable went out
|
||||
# of scope at the end of the block
|
||||
echo $PIRATE
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
In the following code, all output is redirected to the file out.html.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
begin
|
||||
echo $xml_header
|
||||
echo $html_header
|
||||
if test -e $file
|
||||
...
|
||||
end
|
||||
...
|
||||
|
||||
end > out.html
|
||||
</pre>
|
||||
echo $xml_header
|
||||
echo $html_header
|
||||
if test -e $file
|
||||
...
|
||||
end
|
||||
...
|
||||
end > out.html
|
||||
\endfish
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
\section bg bg - send jobs to background
|
||||
|
||||
\subsection bg-synopsis Synopsis
|
||||
<tt>bg [PID...]</tt>
|
||||
\fish{syn}
|
||||
bg [PID...]
|
||||
\endfish
|
||||
|
||||
\subsection bg-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
|
@ -13,5 +15,5 @@ The PID of the desired process is usually found by using <a href="index.html#exp
|
|||
|
||||
\subsection bg-example Example
|
||||
|
||||
<tt>bg \%1</tt> will put the job with job ID 1 in the background.
|
||||
`bg %1` will put the job with job ID 1 in the background.
|
||||
|
||||
|
|
139
doc_src/bind.txt
139
doc_src/bind.txt
|
@ -1,97 +1,94 @@
|
|||
\section bind bind - handle fish key bindings
|
||||
|
||||
\subsection bind-synopsis Synopsis
|
||||
<tt>bind [OPTIONS] SEQUENCE COMMAND</tt>
|
||||
\fish{syn}
|
||||
bind [OPTIONS] SEQUENCE COMMAND
|
||||
\endfish
|
||||
|
||||
\subsection bind-description Description
|
||||
|
||||
<tt>bind</tt> adds a binding for the specified key sequence to the
|
||||
`bind` adds a binding for the specified key sequence to the
|
||||
specified command.
|
||||
|
||||
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
|
||||
\c \\e escape. For example, Alt-w can be written as
|
||||
<tt>\\ew</tt>. The control character can be written in much the same way
|
||||
using the \c \\c escape, for example Control-x (^X) can be written as
|
||||
<tt>\\cx</tt>. 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 \c fish.
|
||||
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`.
|
||||
|
||||
The default key binding can be set by specifying a SEQUENCE of the empty
|
||||
string (that is, <code>''</code>). It will be used whenever no
|
||||
other binding matches. For most key bindings, it makes sense to use
|
||||
the \c self-insert function (i.e. <tt>bind '' self-insert</tt> 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.
|
||||
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.
|
||||
|
||||
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 \c terminfo(5) for more information, or use <tt>bind
|
||||
--key-names</tt> for a list of all available named keys.)
|
||||
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.)
|
||||
|
||||
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.
|
||||
`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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Key bindings are not saved between sessions by default. To save custom
|
||||
keybindings, edit the \c fish_user_key_bindings function and insert the
|
||||
appropriate \c bind statements.
|
||||
keybindings, edit the `fish_user_key_bindings` function and insert the
|
||||
appropriate `bind` statements.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- <tt>-k</tt> or <tt>--key</tt> Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
||||
- <tt>-K</tt> or <tt>--key-names</tt> Display a list of available key names
|
||||
- <tt>-f</tt> or <tt>--function-names</tt> Display a list of available input functions
|
||||
- `-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
|
||||
- `-f` or `--function-names` Display a list of available input functions
|
||||
|
||||
The following special input functions are available:
|
||||
|
||||
- \c backward-char, moves one character to the left
|
||||
- \c backward-delete-char, deletes one character of input to the left of the cursor
|
||||
- \c backward-kill-line, move everything from the beginning of the line to the cursor to the killring
|
||||
- \c backward-kill-word, move the word to the left of the cursor to the killring
|
||||
- \c backward-word, move one word to the left
|
||||
- \c beginning-of-history, move to the beginning of the history
|
||||
- \c beginning-of-line, move to the beginning of the line
|
||||
- \c capitalize-word, make the current word begin with a capital letter
|
||||
- \c complete, guess the remainder of the current token
|
||||
- \c delete-char, delete one character to the right of the cursor
|
||||
- \c delete-line, delete the entire line
|
||||
- \c downcase-word, make the current word lowercase
|
||||
- \c dump-functions, print a list of all key-bindings
|
||||
- \c end-of-history, move to the end of the history
|
||||
- \c end-of-line, move to the end of the line
|
||||
- \c explain, print a description of possible problems with the current command
|
||||
- \c forward-char, move one character to the right
|
||||
- \c forward-word, move one word to the right
|
||||
- \c history-search-backward, search the history for the previous match
|
||||
- \c history-search-forward, search the history for the next match
|
||||
- \c kill-line, move everything from the cursor to the end of the line to the killring
|
||||
- \c kill-whole-line, move the line to the killring
|
||||
- \c kill-word, move the next word to the killring
|
||||
- \c upcase-word, make the current word uppercase
|
||||
- \c yank, insert the latest entry of the killring into the buffer
|
||||
- \c yank-pop, rotate to the previous entry of the killring
|
||||
- `backward-char`, moves one character to the left
|
||||
- `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-word`, move the word to the left of the cursor to the killring
|
||||
- `backward-word`, move one word to the left
|
||||
- `beginning-of-history`, move to the beginning of the history
|
||||
- `beginning-of-line`, move to the beginning of the line
|
||||
- `capitalize-word`, make the current word begin with a capital letter
|
||||
- `complete`, guess the remainder of the current token
|
||||
- `delete-char`, delete one character to the right of the cursor
|
||||
- `delete-line`, delete the entire line
|
||||
- `downcase-word`, make the current word lowercase
|
||||
- `dump-functions`, print a list of all key-bindings
|
||||
- `end-of-history`, move to the end of the history
|
||||
- `end-of-line`, move to the end of the line
|
||||
- `explain`, print a description of possible problems with the current command
|
||||
- `forward-char`, move one character to the right
|
||||
- `forward-word`, move one word to the right
|
||||
- `history-search-backward`, search the history for the previous 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-whole-line`, move the line to the killring
|
||||
- `kill-word`, move the next word to the killring
|
||||
- `upcase-word`, make the current word uppercase
|
||||
- `yank`, insert the latest entry of the killring into the buffer
|
||||
- `yank-pop`, rotate to the previous entry of the killring
|
||||
|
||||
\subsection bind-example Examples
|
||||
|
||||
<tt>bind \\cd 'exit'</tt> causes \c fish to exit when Control-d is pressed.
|
||||
`bind \cd 'exit'` causes `fish` to exit when @key{Control,D} is pressed.
|
||||
|
||||
<tt>bind -k ppage history-search-backward</tt> performs a history search when the Page Up key is pressed.
|
||||
`bind -k ppage history-search-backward` performs a history search when the @key{Page Up} key is pressed.
|
||||
|
||||
|
|
|
@ -1,40 +1,44 @@
|
|||
\section block block - temporarily block delivery of events
|
||||
|
||||
\subsection block-synopsis Synopsis
|
||||
<tt>block [OPTIONS...]</tt>
|
||||
\fish{syn}
|
||||
block [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection block-description Description
|
||||
|
||||
\c block prevents events triggered by \c fish or the
|
||||
<a href="commands.html#emit"><code>emit</code></a> command from
|
||||
`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.
|
||||
|
||||
In functions, \c 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.
|
||||
|
||||
The block can be removed. Any events which triggered while the
|
||||
block was in place will then be delivered.
|
||||
|
||||
Event blocks should not be confused with code blocks, which are created
|
||||
with <code>begin</code>, <code>if</code>, <code>while</code> or
|
||||
<code>for</code>
|
||||
with `begin`, `if`, `while` or
|
||||
`for`
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- <tt>-l</tt> or <tt>--local</tt> Release the block automatically at the end of the current innermost code block scope
|
||||
- <tt>-g</tt> or <tt>--global</tt> Never automatically release the lock
|
||||
- <tt>-e</tt> or <tt>--erase</tt> Release global block
|
||||
- `-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
|
||||
- `-e` or `--erase` Release global block
|
||||
|
||||
\subsection block-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
# Create a function that listens for events
|
||||
function --on-event foo foo; echo 'foo fired'; end
|
||||
|
||||
# Block the delivery of events
|
||||
block -g
|
||||
|
||||
emit foo
|
||||
# No output will be produced
|
||||
|
||||
block -e
|
||||
# 'foo fired' will now be printed
|
||||
</pre>
|
||||
|
||||
\endfish
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
\section break break - stop the current inner loop
|
||||
|
||||
\subsection break-synopsis Synopsis
|
||||
<tt>LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end</tt>
|
||||
\fish{syn}
|
||||
LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
|
||||
\endfish
|
||||
|
||||
|
||||
\subsection break-description Description
|
||||
|
||||
\c 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 <code>break</code>.
|
||||
There are no parameters for `break`.
|
||||
|
||||
\subsection break-example Example
|
||||
The following code searches all .c files for "smurf", and halts at the first occurrence.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
for i in *.c
|
||||
if grep smurf $i
|
||||
echo Smurfs are present in $i
|
||||
break
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
\section breakpoint breakpoint - Launch debug mode
|
||||
|
||||
\subsection breakpoint-synopsis Synopsis
|
||||
<tt>breakpoint</tt>
|
||||
\fish{syn}
|
||||
breakpoint
|
||||
\endfish
|
||||
|
||||
\subsection breakpoint-description Description
|
||||
|
||||
\c breakpoint is used to halt a running script and launch
|
||||
`breakpoint` is used to halt a running script and launch
|
||||
an interactive debugging prompt.
|
||||
|
||||
For more details, see <a href="index.html#debugging">Debugging fish
|
||||
scripts</a> in the \c fish manual.
|
||||
scripts</a> in the `fish` manual.
|
||||
|
||||
There are no parameters for <code>breakpoint</code>.
|
||||
There are no parameters for `breakpoint`.
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
\section builtin builtin - run a builtin command
|
||||
|
||||
\subsection builtin-synopsis Synopsis
|
||||
<tt>builtin BUILTINNAME [OPTIONS...]</tt>
|
||||
\fish{syn}
|
||||
builtin BUILTINNAME [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection builtin-description Description
|
||||
|
||||
\c builtin forces the shell to use a builtin command, rather than a function or program.
|
||||
`builtin` forces the shell to use a builtin command, rather than a function or program.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- <tt>-n</tt> or <tt>--names</tt> List the names of all defined builtins
|
||||
- `-n` or `--names` List the names of all defined builtins
|
||||
|
||||
\subsection builtin-example Example
|
||||
|
||||
<tt>builtin jobs</tt> executes the jobs builtin, even if a function named jobs exists.
|
||||
`builtin jobs` executes the jobs builtin, even if a function named jobs exists.
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
\section case case - conditionally execute a block of commands
|
||||
|
||||
\subsection case-synopsis Synopsis
|
||||
<tt>switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end</tt>
|
||||
\fish{syn}
|
||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||
\endfish
|
||||
|
||||
\subsection case-description Description
|
||||
|
||||
\c switch performs one of several blocks of commands, depending on whether
|
||||
a specified value equals one of several wildcarded values. \c case is used
|
||||
together with the \c switch statement in order to determine which block should
|
||||
`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.
|
||||
|
||||
Each \c case command is given one or more parameters. The first \c 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. \c case parameters may contain
|
||||
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.
|
||||
|
||||
|
@ -29,7 +31,7 @@ against the parameter.
|
|||
If the variable \$animal contains the name of an animal, the following
|
||||
code would attempt to classify it:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
switch $animal
|
||||
case cat
|
||||
echo evil
|
||||
|
@ -43,8 +45,8 @@ switch $animal
|
|||
case '*'
|
||||
echo I have no idea what a $animal is
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
If the above code was run with \c \$animal set to \c whale, the output
|
||||
would be \c mammal.
|
||||
If the above code was run with `$animal` set to `whale`, the output
|
||||
would be `mammal`.
|
||||
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
\section cd cd - change directory
|
||||
|
||||
\subsection cd-synopsis Synopsis
|
||||
<tt>cd [DIRECTORY]</tt>
|
||||
\fish{syn}
|
||||
cd [DIRECTORY]
|
||||
\endfish
|
||||
|
||||
\subsection cd-description Description
|
||||
\c cd changes the current working directory.
|
||||
`cd` changes the current working directory.
|
||||
|
||||
If \c DIRECTORY is supplied, it will become the new directory. If no parameter
|
||||
is given, the contents of the \c HOME environment variable will be used.
|
||||
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.
|
||||
|
||||
If \c DIRECTORY is a relative path, the paths found in the
|
||||
\c CDPATH environment variable array will be tried as prefixes for the specified
|
||||
If `DIRECTORY` is a relative path, the paths found in the
|
||||
`CDPATH` environment variable array will be tried as prefixes for the specified
|
||||
path.
|
||||
|
||||
Note that the shell will attempt to change directory without requiring \c 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
|
||||
|
||||
\c cd changes the working directory to your home directory.
|
||||
`cd` changes the working directory to your home directory.
|
||||
|
||||
<code>cd /usr/src/fish-shell</code> changes the working directory to
|
||||
<code>/usr/src/fish-shell</code>.
|
||||
`cd /usr/src/fish-shell` changes the working directory to
|
||||
`/usr/src/fish-shell`.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
\subsection command-description Description
|
||||
|
||||
\c command forces the shell to execute the program \c COMMANDNAME and ignore any functions or builtins with the same name.
|
||||
`command` forces the shell to execute the program `COMMANDNAME` and ignore any functions or builtins with the same name.
|
||||
|
||||
The following options are available:
|
||||
- \c -h or \c --help prints help and then exits.
|
||||
|
|
|
@ -1,73 +1,75 @@
|
|||
\section commandline commandline - set or get the current command line buffer
|
||||
|
||||
\subsection commandline-synopsis Synopsis
|
||||
<tt>commandline [OPTIONS] [CMD]</tt>
|
||||
\fish{syn}
|
||||
commandline [OPTIONS] [CMD]
|
||||
\endfish
|
||||
|
||||
\subsection commandline-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
With no parameters, \c commandline returns the current value of the command
|
||||
With no parameters, `commandline` returns the current value of the command
|
||||
line.
|
||||
|
||||
With \c CMD specified, the command line buffer is erased and replaced with
|
||||
the contents of \c CMD.
|
||||
With `CMD` specified, the command line buffer is erased and replaced with
|
||||
the contents of `CMD`.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -C or \c --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.
|
||||
- \c -f or \c --function inject readline functions into 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.
|
||||
|
||||
The following options change the way \c commandline updates the
|
||||
The following options change the way `commandline` updates the
|
||||
command line buffer:
|
||||
|
||||
- \c -a or \c --append do not remove the current commandline, append
|
||||
- `-a` or `--append` do not remove the current commandline, append
|
||||
the specified string at the end of it
|
||||
- \c -i or \c --insert do not remove the current commandline, insert
|
||||
- `-i` or `--insert` do not remove the current commandline, insert
|
||||
the specified string at the current cursor position
|
||||
- \c -r or \c --replace remove the current commandline and replace it
|
||||
- `-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:
|
||||
|
||||
- \c -b or \c --current-buffer select the entire buffer (default)
|
||||
- \c -j or \c --current-job select the current job
|
||||
- \c -p or \c --current-process select the current process
|
||||
- \c -t or \c --current-token select the current token.
|
||||
- `-b` or `--current-buffer` select the entire buffer (default)
|
||||
- `-j` or `--current-job` select the current job
|
||||
- `-p` or `--current-process` select the current process
|
||||
- `-t` or `--current-token` select the current token.
|
||||
|
||||
The following options change the way \c commandline prints the current
|
||||
The following options change the way `commandline` prints the current
|
||||
commandline buffer:
|
||||
|
||||
- \c -c or \c --cut-at-cursor only print selection up until the
|
||||
- `-c` or `--cut-at-cursor` only print selection up until the
|
||||
current cursor position
|
||||
- \c -o or \c --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 \c commandline is called during a call to complete a given string
|
||||
using <code>complete -C STRING</code>, \c commandline will consider the
|
||||
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:
|
||||
|
||||
- \c -L or \c --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
|
||||
- \c -S or \c --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
|
||||
- \c -P or \c --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
|
||||
|
||||
|
||||
\subsection commandline-example Example
|
||||
|
||||
<tt>commandline -j $history[3]</tt> 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.
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
/** \page commands Commands bundled with fish
|
||||
/** \page commands Commands
|
||||
|
||||
\htmlonly <div class="fish_left_bar fish_left_little"> \endhtmlonly
|
||||
@command_list_toc@
|
||||
\htmlonly </div> \endhtmlonly
|
||||
|
||||
\htmlonly
|
||||
<div class="fish_right_bar fish_right_big">
|
||||
<h1 class="interior_title_borderless">Commands</h1>
|
||||
Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
|
||||
\htmlonly[block]
|
||||
<div class="fish_left_bar fish_left_little">
|
||||
<div class="menu commands_menu">
|
||||
\endhtmlonly
|
||||
@command_list@
|
||||
\htmlonly </div> \endhtmlonly
|
||||
@command_list_toc@
|
||||
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
</div>
|
||||
<div class="commands fish_right_bar fish_right_big">
|
||||
<h1 class="interior_title">Command reference</h1>
|
||||
\endhtmlonly
|
||||
`fish` ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
|
||||
|
||||
@command_list@
|
||||
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
\endhtmlonly
|
||||
*/
|
||||
|
|
|
@ -28,14 +28,14 @@ the fish manual.
|
|||
|
||||
Command specific tab-completions in \c fish are based on the notion
|
||||
of options and arguments. An option is a parameter which begins with a
|
||||
hyphen, such as '-h', '-help' or '--help'. Arguments are parameters
|
||||
hyphen, such as '`-h`', '`-help`' or '`--help`'. Arguments are parameters
|
||||
that do not begin with a hyphen. Fish recognizes three styles of
|
||||
options, the same styles as the GNU version of the getopt
|
||||
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').
|
||||
- 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 shell') 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').
|
||||
- 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`').
|
||||
- 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
|
||||
switches may all be used multiple times to specify multiple commands
|
||||
|
@ -51,37 +51,39 @@ 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 <tt>complete -e -c
|
||||
COMMAND</tt>, or by specifying a specific completion option to delete
|
||||
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
|
||||
|
||||
The short style option <tt>-o</tt> for the \c gcc command requires
|
||||
that a file follows it. This can be done using writing <tt>complete
|
||||
-c gcc -s o -r</tt>.
|
||||
The short style option `-o` for the `gcc` command requires
|
||||
that a file follows it. This can be done using writing:
|
||||
|
||||
The short style option <tt>-d</tt> for the \c grep command requires
|
||||
that one of the strings 'read', 'skip' or 'recurse' is used. This can
|
||||
be specified writing <tt>complete -c grep -s d -x -a "read skip
|
||||
recurse"</tt>.
|
||||
`complete -c gcc -s o -r`
|
||||
|
||||
The \c su command takes any username as an argument. Usernames are
|
||||
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:
|
||||
|
||||
`complete -c grep -s d -x -a "read skip recurse"`
|
||||
|
||||
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: <tt>complete -x -c su -d "Username" -a "(cat
|
||||
/etc/passwd|cut -d : -f 1)" </tt>.
|
||||
can be specified as:
|
||||
|
||||
The \c rpm command has several different modes. If the \c -e or \c
|
||||
--erase flag has been specified, \c rpm should delete one or more
|
||||
packages, in which case several switches related to deleting packages
|
||||
are valid, like the \c nodeps switch.
|
||||
`complete -x -c su -d "Username" `
|
||||
`-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
|
||||
packages, in which case several switches related to deleting packages are valid, like the `nodeps` switch.
|
||||
|
||||
This can be written as:
|
||||
|
||||
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d
|
||||
"Don't check dependencies"</tt>
|
||||
`complete -c rpm -n "__fish_contains_opt -s e erase"`
|
||||
`-l nodeps -d "Don't check dependencies"`
|
||||
|
||||
where \c __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.
|
||||
|
||||
To implement an alias, use the \c -w or \c --wraps option:
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
\section contains contains - test if a word is present in a list
|
||||
|
||||
\subsection contains-synopsis Synopsis
|
||||
<code>contains [OPTIONS] KEY [VALUES...]</code>
|
||||
\fish{syn}
|
||||
contains [OPTIONS] KEY [VALUES...]
|
||||
\endfish
|
||||
|
||||
\subsection contains-description Description
|
||||
|
||||
\c contains tests whether the set \c VALUES contains the string
|
||||
<code>KEY</code>. If so, \c contains exits with status 0; if not, it exits
|
||||
`contains` tests whether the set `VALUES` contains the string
|
||||
`KEY`. If so, `contains` exits with status 0; if not, it exits
|
||||
with status 1.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -i or \c --index print the word index
|
||||
- \c -h or \c --help display this message
|
||||
- `-i` or `--index` print the word index
|
||||
- `-h` or `--help` display this message
|
||||
|
||||
\subsection contains-example Example
|
||||
<pre>
|
||||
for i in ~/bin /usr/local/bin
|
||||
if not contains \$i \$PATH
|
||||
set PATH \$PATH \$i
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
|
||||
The above code tests if \c ~/bin and \c /usr/local/bin are in the path and adds them if not.
|
||||
\fish
|
||||
for i in ~/bin /usr/local/bin
|
||||
if not contains $i $PATH
|
||||
set PATH $PATH $i
|
||||
end
|
||||
end
|
||||
\endfish
|
||||
|
||||
The above code tests if `~/bin` and `/usr/local/bin` are in the path and adds them if not.
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
\section continue continue - skip the remainder of the current iteration of the current inner loop
|
||||
|
||||
\subsection continue-synopsis Synopsis
|
||||
<tt>LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end</tt>
|
||||
\fish{syn}
|
||||
LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end
|
||||
\endfish
|
||||
|
||||
\subsection continue-description Description
|
||||
\c 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
|
||||
The following code removes all tmp files that do not contain the word smurf.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
for i in *.tmp
|
||||
if grep smurf $i
|
||||
continue
|
||||
end
|
||||
rm $i
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
\section count count - count the number of elements of an array
|
||||
|
||||
\subsection count-synopsis Synopsis
|
||||
<tt>count $VARIABLE</tt>
|
||||
\fish{syn}
|
||||
count $VARIABLE
|
||||
\endfish
|
||||
|
||||
\subsection count-description Description
|
||||
|
||||
<tt>count</tt> 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.
|
||||
|
||||
\c count does not accept any options, including '-h'.
|
||||
`count` does not accept any options, including '`-h`'.
|
||||
|
||||
\c 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.
|
||||
|
||||
\subsection count-example Example
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
/** \page design Design document
|
||||
|
||||
\htmlonly <div class="fish_only_bar"> \endhtmlonly
|
||||
\htmlonly[block]
|
||||
<div class="fish_only_bar">
|
||||
<div class="design">
|
||||
<h1 class="interior_title">Design documentation</h1>
|
||||
\endhtmlonly
|
||||
|
||||
\section design-overview Overview
|
||||
|
||||
|
@ -35,8 +39,8 @@ program harder to maintain and update.
|
|||
Examples:
|
||||
|
||||
- Here documents are too similar to using echo inside of a pipeline.
|
||||
- Subshells, command substitution and process substitution are strongly related. \c 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. \c fish functions have none of the drawbacks of either syntax.
|
||||
- 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.
|
||||
- The many Posix quoting styles are silly, especially \$''.
|
||||
|
||||
\section sep The law of responsiveness
|
||||
|
@ -104,7 +108,7 @@ 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.
|
||||
- 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.
|
||||
- All blocks end with the \c end builtin.
|
||||
- All blocks end with the `end` builtin.
|
||||
|
||||
\section disc The law of discoverability
|
||||
|
||||
|
@ -133,6 +137,9 @@ 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.
|
||||
|
||||
*/
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
\htmlonly </div> \endhtmlonly
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
\section dirh dirh - print directory history
|
||||
|
||||
\subsection dirh-synopsis Synopsis
|
||||
<tt>dirh</tt>
|
||||
\fish{syn}
|
||||
dirh
|
||||
\endfish
|
||||
|
||||
\subsection dirh-description Description
|
||||
|
||||
<tt>dirh</tt> 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
|
||||
<tt>fish_color_history_current</tt> environment variable.
|
||||
`fish_color_history_current` environment variable.
|
||||
|
||||
\c dirh does not accept any parameters.
|
||||
`dirh` does not accept any parameters.
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
\section dirs dirs - print directory stack
|
||||
|
||||
\subsection dirs-synopsis Synopsis
|
||||
<tt>dirs</tt>
|
||||
\fish{syn}
|
||||
dirs
|
||||
\endfish
|
||||
|
||||
\subsection dirs-description Description
|
||||
<tt>dirs</tt> prints the current directory stack, as created by the
|
||||
<code><a href="#pushd">pushd</a></code> command.
|
||||
`dirs` prints the current directory stack, as created by the
|
||||
<a href="#pushd">`pushd`</a> command.
|
||||
|
||||
\c dirs does not accept any parameters.
|
||||
`dirs` does not accept any parameters.
|
||||
|
|
|
@ -1,39 +1,41 @@
|
|||
\section echo echo - display a line of text
|
||||
|
||||
\subsection echo-synopsis Synopsis
|
||||
<tt>echo [STRING]</tt>
|
||||
\fish{syn}
|
||||
echo [STRING]
|
||||
\endfish
|
||||
|
||||
\subsection echo-description Description
|
||||
|
||||
\c echo displays a string of text.
|
||||
`echo` displays a string of text.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -n, \c Do not output a newline
|
||||
- \c -s, \c Do not separate arguments with spaces
|
||||
- \c -E, \c Disable interpretation of backslash escapes (default)
|
||||
- \c -e, \c Enable interpretation of backslash escapes
|
||||
- \c -h, \c --help Display this help
|
||||
- `-n`, Do not output a newline
|
||||
- `-s`, Do not separate arguments with spaces
|
||||
- `-E`, Disable interpretation of backslash escapes (default)
|
||||
- `-e`, Enable interpretation of backslash escapes
|
||||
- `-h`, `--help` Display this help
|
||||
|
||||
\subsection echo-escapes Escape Sequences
|
||||
|
||||
If \c -e is used, the following sequences are recognized:
|
||||
If `-e` is used, the following sequences are recognized:
|
||||
|
||||
- \c \\\\ \c backslash
|
||||
- \\a alert (BEL)
|
||||
- \\b backspace
|
||||
- \\c produce no further output
|
||||
- \\e escape
|
||||
- \\f form feed
|
||||
- \\n new line
|
||||
- \\r carriage return
|
||||
- \\t horizontal tab
|
||||
- \\v vertical tab
|
||||
- \\0NNN byte with octal value NNN (1 to 3 digits)
|
||||
- \\xHH byte with hexadecimal value HH (1 to 2 digits)
|
||||
- `\` backslash
|
||||
- `\a` alert (BEL)
|
||||
- `\b` backspace
|
||||
- `\c` produce no further output
|
||||
- `\e` escape
|
||||
- `\f` form feed
|
||||
- `\n` new line
|
||||
- `\r` carriage return
|
||||
- `\t` horizontal tab
|
||||
- `\v` vertical tab
|
||||
- `\0NNN` byte with octal value NNN (1 to 3 digits)
|
||||
- `\xHH` byte with hexadecimal value HH (1 to 2 digits)
|
||||
|
||||
\subsection echo-example Example
|
||||
|
||||
<tt>echo 'Hello World'</tt> Print hello world to stdout
|
||||
`echo 'Hello World'` Print hello world to stdout
|
||||
|
||||
<tt>echo -e 'Top\\nBottom'</tt> 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
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
\section else else - execute command if a condition is not met
|
||||
|
||||
\subsection else-synopsis Synopsis
|
||||
<tt>if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end</tt>
|
||||
\fish{syn}
|
||||
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||
\endfish
|
||||
|
||||
\subsection else-description Description
|
||||
<tt>if</tt> will execute the command \c CONDITION. If the condition's exit
|
||||
status is 0, the commands \c COMMANDS_TRUE will execute. If it is not 0 and
|
||||
<tt>else</tt> is given, \c COMMANDS_FALSE will be executed.
|
||||
`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.
|
||||
|
||||
\subsection else-example Example
|
||||
|
||||
The following code tests whether a file \c foo.txt exists as a regular file.
|
||||
The following code tests whether a file `foo`.txt exists as a regular file.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
if test -f foo.txt
|
||||
echo foo.txt exists
|
||||
else
|
||||
echo foo.txt does not exist
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
\section emit emit - Emit a generic event
|
||||
|
||||
\subsection block-synopsis Synopsis
|
||||
<tt>emit EVENT_NAME [ARGUMENTS...]</tt>
|
||||
\subsection emit-synopsis Synopsis
|
||||
\fish{syn}
|
||||
emit EVENT_NAME [ARGUMENTS...]
|
||||
\endfish
|
||||
|
||||
\subsection emit-description Description
|
||||
|
||||
\c 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
|
||||
|
||||
The following code first defines an event handler for the generic
|
||||
event named 'test_event', and then emits an event of that type.
|
||||
|
||||
<pre>function event_test --on-event test_event
|
||||
\fish
|
||||
function event_test --on-event test_event
|
||||
echo event test: $argv
|
||||
end
|
||||
|
||||
emit test_event something
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
\section end end - end a block of commands.
|
||||
|
||||
\subsection end-synopsis Synopsis
|
||||
<pre>
|
||||
\fish{syn}
|
||||
begin; [COMMANDS...] end
|
||||
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||
while CONDITION; COMMANDS...; end
|
||||
for VARNAME in [VALUES...]; COMMANDS...; end
|
||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
\subsection end-description Description
|
||||
<tt>end</tt> ends a block of commands.
|
||||
`end` ends a block of commands.
|
||||
|
||||
For more information, read the
|
||||
documentation for the block constructs, such as \c if, \c for and \c
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
\section eval eval - evaluate the specified commands
|
||||
|
||||
\subsection eval-synopsis Synopsis
|
||||
<tt>eval [COMMANDS...]</tt>
|
||||
\fish{syn}
|
||||
eval [COMMANDS...]
|
||||
\endfish
|
||||
|
||||
\subsection eval-description Description
|
||||
<tt>eval</tt> 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
|
||||
|
||||
|
@ -12,8 +14,8 @@ The following code will call the ls command. Note that \c fish does not
|
|||
support the use of shell variables as direct commands; \c eval can
|
||||
be used to work around this.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
set cmd ls
|
||||
eval $cmd
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
\section exec exec - execute command in current process
|
||||
|
||||
\subsection exec-synopsis Synopsis
|
||||
<tt>exec COMMAND [OPTIONS...]</tt>
|
||||
\fish{syn}
|
||||
exec COMMAND [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection exec-description Description
|
||||
|
||||
\c exec replaces the currently running shell with a new command.
|
||||
On successful completion, \c exec never returns. \c exec cannot be used
|
||||
`exec` replaces the currently running shell with a new command.
|
||||
On successful completion, `exec` never returns. `exec` cannot be used
|
||||
inside a pipeline.
|
||||
|
||||
\subsection exec-example Example
|
||||
|
||||
<tt>exec emacs</tt> starts up the emacs text editor, and exits \c fish.
|
||||
`exec emacs` starts up the emacs text editor, and exits `fish`.
|
||||
When emacs exits, the session will terminate.
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
\section exit exit - exit the shell
|
||||
|
||||
\subsection exit-synopsis Synopsis
|
||||
<tt>exit [STATUS]</tt>
|
||||
\fish{syn}
|
||||
exit [STATUS]
|
||||
\endfish
|
||||
|
||||
\subsection exit-description Description
|
||||
|
||||
\c exit causes fish to exit. If <tt>STATUS</tt> 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.
|
||||
|
||||
|
|
209
doc_src/faq.hdr
209
doc_src/faq.hdr
|
@ -1,9 +1,13 @@
|
|||
/** \page faq Frequently asked questions
|
||||
|
||||
\htmlonly <div class="fish_left_bar fish_left_big"> \endhtmlonly
|
||||
\htmlonly[block]
|
||||
<div class="fish_left_bar">
|
||||
<div class="menu faq_menu">
|
||||
|
||||
\endhtmlonly
|
||||
|
||||
- <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 <tt>.bashrc</tt>?</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-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>
|
||||
|
@ -20,177 +24,142 @@
|
|||
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
||||
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
|
||||
|
||||
\htmlonly
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
<div class="fish_right_bar fish_right_little">
|
||||
</div>
|
||||
<div class="faq fish_right_bar">
|
||||
<h1 class="interior_title">Frequently Asked Questions</h1>
|
||||
|
||||
\endhtmlonly
|
||||
|
||||
\section faq-envvar How do I set or clear an environment variable?
|
||||
|
||||
Use the <a href="commands.html#set"><code>set</code></a> command:
|
||||
Use the <a href="commands.html#set">`set`</a> command:
|
||||
|
||||
<pre>set -x key value
|
||||
set -e key</pre>
|
||||
\fish
|
||||
set -x key value
|
||||
set -e key
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-login-cmd How do I run a command every login? What's fish's equivalent to .bashrc?
|
||||
|
||||
Edit the file <tt>~/.config/fish/config.fish</tt>, 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?
|
||||
|
||||
The prompt is the output of the \c fish_prompt function. Put it in
|
||||
<tt>~/.config/fish/functions/fish_prompt.fish</tt>. For example, a simple
|
||||
prompt is:
|
||||
<pre>function fish_prompt
|
||||
set_color $fish_color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
echo -n ' > '
|
||||
end</pre>
|
||||
The prompt is the output of the `fish_prompt` function. Put it in `~/.config/fish/functions/fish_prompt.fish`. For example, a simple prompt is:
|
||||
|
||||
You can also use the Web configuration tool,
|
||||
<a href="commands.html#fish_config"><code>fish_config</code></a>, to preview
|
||||
and choose from a gallery of sample prompts.
|
||||
\fish
|
||||
function fish_prompt
|
||||
set_color $fish_color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
echo -n ' > '
|
||||
end
|
||||
\endfish
|
||||
|
||||
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?
|
||||
|
||||
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!
|
||||
|
||||
\c fish uses parentheses for subcommands. For example:
|
||||
`fish` uses parentheses for subcommands. For example:
|
||||
|
||||
<pre>for i in (ls)
|
||||
echo $i
|
||||
end</pre>
|
||||
\fish
|
||||
for i in (ls)
|
||||
echo $i
|
||||
end
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-exit-status How do I get the exit status of a command?
|
||||
|
||||
Use the \c $status variable. This replaces the \c $? 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?
|
||||
|
||||
<i><tt>SOME_VAR=1 command</tt> produces an error: <tt>Unknown command "SOME_VAR=1"</tt>.</i>
|
||||
<i>`SOME_VAR=1 command` produces an error: `Unknown command "SOME_VAR=1"`.</i>
|
||||
|
||||
Use the \c env command.
|
||||
Use the `env` command.
|
||||
|
||||
<tt>env SOME_VAR=1 command</tt>
|
||||
`env SOME_VAR=1 command`
|
||||
|
||||
You can also declare a local variable in a block:
|
||||
|
||||
<pre>begin
|
||||
set -lx SOME_VAR 1
|
||||
command
|
||||
end</pre>
|
||||
\fish
|
||||
begin
|
||||
set -lx SOME_VAR 1
|
||||
command
|
||||
end
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-customize-colors How do I customize my syntax highlighting colors?
|
||||
|
||||
Use the web configuration tool,
|
||||
<a href="commands.html#fish_config"><code>fish_config</code></a>, or alter the
|
||||
<a href="index.html#variables-color">\c 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?
|
||||
|
||||
Use the
|
||||
<a href="commands.html#fish_update_completions"><tt>fish_update_completions</tt></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?
|
||||
|
||||
<i>
|
||||
For example if ~/images is a symlink to ~/Documents/Images, if I write
|
||||
'cd images', my prompt will say ~/D/Images, not ~/images.
|
||||
</i>
|
||||
<i>For example if `~/images` is a symlink to `~/Documents/Images`, if I write '`cd images`', my prompt will say `~/D/Images`, not `~/images`.</i>
|
||||
|
||||
Because it is impossible to consistently keep symlinked directories
|
||||
unresolved. It is indeed possible to do this partially, and many other
|
||||
shells do so. But it was felt there are enough serious corner cases
|
||||
that this is a bad idea. Most such issues have to do with how '..' is
|
||||
handled, and are varitations of the following example:
|
||||
Because it is impossible to consistently keep symlinked directories unresolved. It is indeed possible to do this partially, and many other shells do so. But it was felt there are enough serious corner cases that this is a bad idea. Most such issues have to do with how '..' is handled, and are varitations of the following example:
|
||||
|
||||
Writing <code>cd images; ls ..</code> given the above directory
|
||||
structure would list the contents of ~/Documents, not of ~, even
|
||||
though using <code>cd ..</code> changes the current directory to ~,
|
||||
and the prompt, the pwd builtin and many other directory information
|
||||
sources suggest that the current directory is ~/images and its
|
||||
parent is ~. This issue is not possible to fix without either making
|
||||
every single command into a builtin, breaking Unix semantics or
|
||||
implementing kludges in every single command.
|
||||
Writing `cd images; ls ..` given the above directory structure would list the contents of `~/Documents`, not of `~`, even though using `cd ..` changes the current directory to `~`, and the prompt, the `pwd` builtin and many other directory information sources suggest that the current directory is `~/images` and its parent is `~`. This issue is not possible to fix without either making every single command into a builtin, breaking Unix semantics or implementing kludges in every single command. This issue can also be seen when doing IO redirection.
|
||||
|
||||
This issue can also be seen when doing IO redirection.
|
||||
|
||||
Another related issue is that many programs that operate on recursive
|
||||
directory trees, like the find command, silently ignore symlinked
|
||||
directories. For example, <code>find $PWD -name '*.txt'</code>
|
||||
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?
|
||||
|
||||
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
|
||||
<code>~</code> 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.
|
||||
|
||||
The \c open command uses the MIME type database and the <code>.desktop</code> 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?
|
||||
|
||||
If you installed fish manually (e.g. by compiling it, not by using a
|
||||
package manager), you first need to add fish to the list of shells by
|
||||
executing the following command (assuming you installed fish in
|
||||
/usr/local) as root:
|
||||
If you installed fish manually (e.g. by compiling it, not by using a package manager), you first need to add fish to the list of shells by executing the following command (assuming you installed fish in /usr/local) as root:
|
||||
|
||||
\fish
|
||||
echo /usr/local/bin/fish >>/etc/shells
|
||||
\endfish
|
||||
|
||||
<code>echo /usr/local/bin/fish >>/etc/shells</code>
|
||||
|
||||
If you installed a prepackaged version of fish, the package manager
|
||||
should have already done this for you.
|
||||
If you installed a prepackaged version of fish, the package manager should have already done this for you.
|
||||
|
||||
In order to change your default shell, type:
|
||||
|
||||
<code>chsh -s /usr/local/bin/fish</code>
|
||||
\fish
|
||||
chsh -s /usr/local/bin/fish
|
||||
\endfish
|
||||
|
||||
You may need to adjust the above path to e.g. \c /usr/bin/fish. Use the command <code>which fish</code> if you are unsure of where fish is installed.
|
||||
You may need to adjust the above path to e.g. `/usr/bin/fish`. Use the command `which fish` if you are unsure of where fish is installed.
|
||||
|
||||
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>
|
||||
|
||||
|
@ -200,57 +169,41 @@ Quick answer:
|
|||
|
||||
Run the following command in fish:
|
||||
|
||||
<pre>
|
||||
echo 'function fish_title;end' > ~/.config/fish/config.fish
|
||||
</pre>
|
||||
\fish
|
||||
echo 'function fish_title;end' > ~/.config/fish/config.fish
|
||||
\endfish
|
||||
|
||||
Problem solved!
|
||||
|
||||
The long answer:
|
||||
|
||||
Fish is trying to set the titlebar message of your terminal. While
|
||||
screen itself supports this feature, your terminal does
|
||||
not. Unfortunately, when the underlying terminal doesn't support
|
||||
setting the titlebar, screen simply passes through the escape codes
|
||||
and text to the underlying terminal instead of ignoring them. It is
|
||||
impossible detect and resolve this problem from inside fish since fish
|
||||
has no way of knowing what the underlying terminal type is. For now,
|
||||
the only way to fix this is to unset the titlebar message, as
|
||||
suggested above.
|
||||
Fish is trying to set the titlebar message of your terminal. While screen itself supports this feature, your terminal does not. Unfortunately, when the underlying terminal doesn't support setting the titlebar, screen simply passes through the escape codes and text to the underlying terminal instead of ignoring them. It is impossible detect and resolve this problem from inside fish since fish has no way of knowing what the underlying terminal type is. For now, the only way to fix this is to unset the titlebar message, as suggested above.
|
||||
|
||||
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?
|
||||
|
||||
Change the value of the variable \c fish_greeting or create a \c fish_greeting
|
||||
function. For example, to remove the greeting use:
|
||||
Change the value of the variable `fish_greeting` or create a `fish_greeting` function. For example, to remove the greeting use:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
set fish_greeting
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
||||
|
||||
Because history substitution is an awkward interface that was invented before
|
||||
interactive line editing was even possible. Fish drops it in favor of
|
||||
perfecting the interactive history recall interface. Switching requires a
|
||||
small change of habits: if you want to modify an old line/word, first recall
|
||||
it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
|
||||
type "sudo ".
|
||||
Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Fish drops it in favor of perfecting the interactive history recall interface. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then type "sudo ".
|
||||
|
||||
Fish history recall is very simple yet effective:
|
||||
|
||||
- As in any modern shell, the Up arrow 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.
|
||||
- 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 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 (Alt+D and Alt+Backspace are your friends).
|
||||
- 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.
|
||||
- @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 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.
|
||||
|
||||
|
@ -258,19 +211,19 @@ See <a href='index.html#editor'>documentation</a> for more details about line ed
|
|||
|
||||
\section faq-uninstalling Uninstalling fish
|
||||
|
||||
Should you wish to uninstall fish, first ensure fish is not set as your shell. Run <code>chsh -s /bin/bash</code> if you are not sure.
|
||||
Should you wish to uninstall fish, first ensure fish is not set as your shell. Run `chsh -s /bin/bash` if you are not sure.
|
||||
|
||||
Next, do the following (assuming fish was installed to /usr/local):
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
rm -Rf /usr/local/etc/fish /usr/local/share/fish ~/.config/fish
|
||||
rm /usr/local/share/man/man1/fish*.1
|
||||
cd /usr/local/bin
|
||||
rm -f fish mimedb fishd fish_indent
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
*/
|
||||
|
||||
\htmlonly
|
||||
\htmlonly[block]
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
*/
|
|
@ -1,14 +1,16 @@
|
|||
\section fg fg - bring job to foreground
|
||||
|
||||
\subsection fg-synopsis Synopsis
|
||||
<tt>fg [PID]</tt>
|
||||
\fish{syn}
|
||||
fg [PID]
|
||||
\endfish
|
||||
|
||||
\subsection fg-description Description
|
||||
\c 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
|
||||
`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>.
|
||||
|
||||
\subsection fg-example Example
|
||||
|
||||
<tt>fg \%1</tt> will put the job with job ID 1 in the foreground.
|
||||
`fg %1` will put the job with job ID 1 in the foreground.
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
\section fish fish - the friendly interactive shell
|
||||
|
||||
\subsection fish-synopsis Synopsis
|
||||
\fish{syn}
|
||||
fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]]
|
||||
\endfish
|
||||
|
||||
\subsection fish-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <code>-c</code> or <code>--command=COMMANDS</code> evaluate the specified commands instead of reading from the commandline
|
||||
- <code>-d</code> or <code>--debug-level=DEBUG_LEVEL</code> specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||
- <code>-h</code> or <code>--help</code> display help and exit
|
||||
- <code>-i</code> or <code>--interactive</code> specify that fish is to run in interactive mode
|
||||
- <code>-l</code> or <code>--login</code> specify that fish is to run as a login shell
|
||||
- <code>-n</code> or <code>--no-execute</code> do not execute any commands, only perform syntax checking
|
||||
- <code>-p</code> or <code>--profile=PROFILE_FILE</code> when fish exits, output timing information on all executed commands to the specified file
|
||||
- <code>-v</code> or <code>--version</code> display version and exit
|
||||
- `-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.
|
||||
- `-h` or `--help` display help and exit
|
||||
- `-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
|
||||
- `-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
|
||||
- `-v` or `--version` display version and exit
|
||||
|
||||
The fish exit status is generally the exit status of the last
|
||||
foreground command. If fish is exiting because of a parse error, the
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
\subsection fish_config-description Description
|
||||
|
||||
\c 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
|
||||
to make changes to your prompt and color configuration.
|
||||
|
||||
\c 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.
|
||||
|
||||
<code>fish_config</code> optionally accepts name of the initial configuration tab. For e.g. <code>fish_config history</code> 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 \c 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.
|
||||
|
||||
\subsection fish_config-example Example
|
||||
|
||||
\c 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.
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
\section fish_indent fish_indent - indenter and prettifier
|
||||
|
||||
\subsection fish_indent-synopsis Synopsis
|
||||
<tt>fish_indent [options]</tt>
|
||||
\fish{syn}
|
||||
fish_indent [options]
|
||||
\endfish
|
||||
|
||||
\subsection fish_indent-description Description
|
||||
|
||||
\c fish_indent is used to indent a piece of fish
|
||||
code. \c fish_indent reads commands from standard input and outputs
|
||||
`fish_indent` is used to indent a piece of fish
|
||||
code. `fish_indent` reads commands from standard input and outputs
|
||||
them to standard output.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
|
||||
- <tt>-i</tt> or <tt>--no-indent</tt> do not indent commands
|
||||
- <tt>-v</tt> or <tt>--version</tt> displays the current fish version and then exits
|
||||
- `-h` or `--help` displays this help message and then exits
|
||||
- `-i` or `--no-indent` do not indent commands
|
||||
- `-v` or `--version` displays the current fish version and then exits
|
||||
|
||||
|
|
367
doc_src/fish_lexicon_filter.in
Normal file
367
doc_src/fish_lexicon_filter.in
Normal file
|
@ -0,0 +1,367 @@
|
|||
#! @sed@ -f
|
||||
#.
|
||||
# A Doxygen filter for building Fish's lexicon, for documentation bling.
|
||||
#.
|
||||
# Written specially for Fish, the shell for the 90's, in sed, the state of the
|
||||
# art text processor from the 70's. Who's sed? sed's dead, baby, sed's dead.*
|
||||
# by Mark Griffiths <mark@thebespokepixel.com> *but quite portable
|
||||
#.
|
||||
# Finds /fish../endfish blocks in documentation source files and enhances
|
||||
# markup. Requires that the short tags declared here are added to Doxyfiles as
|
||||
# aliases i.e.:
|
||||
#.
|
||||
# Enhance for HTML Help pages (Doxyfile.user)…
|
||||
# ALIASES = "fish=\htmlonly[block] \n<pre class=\"fish\">"
|
||||
# ALIASES += "fish{1}=\htmlonly[block] \n<pre class=\"fish \1\">"
|
||||
# ALIASES += "endfish=</pre>\endhtmlonly \n"
|
||||
#.
|
||||
# ALIASES += "blah{1}=<span class=\"comment\">\1</span>"
|
||||
# ALIASES += "cmnd{1}=<span class=\"command\">\1</span>" and so on...
|
||||
#.
|
||||
# And simplify for man pages (Doxyfile.help)…
|
||||
# ALIASES = "fish=<pre>"
|
||||
# ALIASES += "fish{1}=<pre>"
|
||||
# ALIASES += "endfish=</pre>"
|
||||
#.
|
||||
# ALIASES += "blah{1}=\1"
|
||||
# ALIASES += "cmnd{1}=<em>\1</em>"...
|
||||
#.
|
||||
# Licensed under whatever terms are most compatible with Fish's GPLv2 license,
|
||||
# bascially free to use/reuse/redistribute/laugh at/be inspired by. Don't
|
||||
# pretend it's your code unless you've spent more late nights on it than me but
|
||||
# if it saves you a late night, do what you can to help rebalance karma. If it
|
||||
# doesn't work or breaks something, it's your fault for using it: if it seems
|
||||
# to work it's more likely a hallucination than anything based in reality.
|
||||
#.
|
||||
# Pattern flow control for scanning doc.h
|
||||
/\\fish/,/\\endfish/ {
|
||||
# Open \fish block
|
||||
/^\\fish$/b
|
||||
/^\\fish{[^}]*}$/b
|
||||
/^\\fish.*$/ {
|
||||
s/^\\fish//
|
||||
s/\\endfish//
|
||||
b process
|
||||
}
|
||||
# Output blank lines
|
||||
/^$/b
|
||||
# Inside \fish block. Process...
|
||||
/\\endfish/!{
|
||||
# Preprocess HTML and HTML-like formatting
|
||||
/<[^>]*>/ {
|
||||
b html
|
||||
}
|
||||
# Process the rest
|
||||
b process
|
||||
}
|
||||
# End block
|
||||
/\\endfish/b
|
||||
}
|
||||
/style/b styles
|
||||
#.
|
||||
# This is not the pattern we're looking for
|
||||
b
|
||||
#.
|
||||
# Sets CSS styles according to fish defaults.
|
||||
#.
|
||||
# Used for building the documentation's CSS file
|
||||
#.
|
||||
:processstyle
|
||||
#. Make Hex uniform
|
||||
s/0x//g
|
||||
/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]*/ {
|
||||
y/ABCDEF/abcdef/
|
||||
s/^[0-9a-f]/#&/
|
||||
}
|
||||
#.
|
||||
# Set simple styles
|
||||
#.
|
||||
s/bold/font-weight:bold;/
|
||||
#.
|
||||
# Replace named colours (taken from color.cpp)
|
||||
#.
|
||||
s/black/#000/
|
||||
s/red/#f00/
|
||||
s/green/#0f0/
|
||||
s/brown/#725000/
|
||||
s/yellow/#ff0/
|
||||
s/blue/#00f/
|
||||
s/magenta/#f0f/
|
||||
s/purple/#f0f/
|
||||
s/cyan/#0ff/
|
||||
s/white/#fff/
|
||||
s/normal/#fff text-decoration:none; border-bottom:none; font-weight:normal;/
|
||||
#.
|
||||
/background/ {
|
||||
s/background=\(#[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*\)/background-color: \1;/
|
||||
}
|
||||
/underline/ {
|
||||
s/^\(#[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*\).*$/\1 border-bottom: 2px solid \1;/
|
||||
s/^underline$/text-decoration: underline;/
|
||||
}
|
||||
# If we start with just a colour, make it explicit.
|
||||
s/^#[0-9a-f][0-9a-f]*/color: &;/
|
||||
#.
|
||||
# All done, return CSS style content
|
||||
b
|
||||
# Process any HTML tags.
|
||||
# Structured to reduce sed's greediness.
|
||||
:html
|
||||
# Spans
|
||||
s|<span style=['"]\([^'"][^'"]*\)">|@span{\1,|
|
||||
s|<span class=['"]\([^'"][^'"]*\)">|@spcl{\1,|
|
||||
s|</span>|}|
|
||||
t html
|
||||
#.
|
||||
# Bold
|
||||
s|<b>|@bold{|
|
||||
s|<b [^>]*>|@bold{|
|
||||
s|</b>|}|
|
||||
#.
|
||||
# Strong
|
||||
s|<strong>|@bold{|
|
||||
s|<strong [^>]*>|@bold{|
|
||||
s|</strong>|}|
|
||||
#.
|
||||
# Italic
|
||||
s|<i>|@emph{|
|
||||
s|<i [^>]*>|@emph{|
|
||||
s|</i>|}|
|
||||
#.
|
||||
# Emphasis
|
||||
s|<em>|@emph{|
|
||||
s|<em [^>]*>|@emph{|
|
||||
s|</em>|}|
|
||||
#.
|
||||
# Underline
|
||||
s|<u>|@undr{|
|
||||
s|<u [^>]*>|@undr{|
|
||||
s|</u>|}|
|
||||
t html
|
||||
#.
|
||||
# Some handy non-standard extensions
|
||||
# Autosuggestion
|
||||
s|<s>|@sgst{|
|
||||
s|<s [^>]*>|@sgst{|
|
||||
s|</s>|}|
|
||||
#.
|
||||
# Error
|
||||
s|<error>|@eror{|
|
||||
s|<error [^>]*>|@eror{|
|
||||
s|</error>|}|
|
||||
#.
|
||||
# File declaration
|
||||
s|<file>|@fsfo{|
|
||||
s|<file [^>]*>|@fsfo{|
|
||||
s|</file>|}|
|
||||
#.
|
||||
# AsIs - protect from auto-formatting
|
||||
s|<asis>|@asis{|
|
||||
s|</asis>|}|
|
||||
t html
|
||||
#.
|
||||
# Clean other unhandled html
|
||||
s|<\([A-Za-z][A-Za-z]*\)[^>]*>\([^<]*\)</\1>|\2|
|
||||
t html
|
||||
#.
|
||||
# Start processing entities
|
||||
:process
|
||||
#.
|
||||
# Comments:
|
||||
# Capture full line comments
|
||||
/^#.*$/ {
|
||||
# Assume any line starting with a # is complete
|
||||
s//@blah{&}/
|
||||
t
|
||||
}
|
||||
# Match sub-line comments
|
||||
/#[^0-9A-Za-z][ ]*.*$/ {
|
||||
# Assume comment finishes a line
|
||||
s//@blah{&}/
|
||||
t
|
||||
}
|
||||
#.
|
||||
# Protected entities These shouldn't allow nested structure, so we move them
|
||||
# to a marked, new line for a future extract/process/insert action.
|
||||
#.
|
||||
# AsIs block - resists formatting.
|
||||
s/@asis{\(.*\)}/\\\
|
||||
<@asis{\1}\
|
||||
/g
|
||||
#.
|
||||
# String Literals
|
||||
s/"\([^"]*\)"/\\\
|
||||
<@dblq{\1}\
|
||||
/g
|
||||
s/'\([^']*\)'/\\\
|
||||
<@sglq{\1}\
|
||||
/g
|
||||
#.
|
||||
# Command/Function options
|
||||
# Short options
|
||||
s/-\([A-Za-z]\)\([^A-Za-z}]\)/\\\
|
||||
<@opts{-\1}\
|
||||
\2/g
|
||||
#.
|
||||
# Long options
|
||||
s/--\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9]\)/\\\
|
||||
<@opts{--\1}\
|
||||
\2/g
|
||||
#.
|
||||
# Paths
|
||||
# Normal Directory
|
||||
s|\([^/~A-Za-z0-9]\)\([~/][/]*\)\([A-Za-z_0-9./-]*\)|\1\\\
|
||||
<@path{\2\3}\
|
||||
|g
|
||||
#.
|
||||
b protect
|
||||
# Tidy up. Merge back 'pure' entities from hold space.
|
||||
:tidy
|
||||
#.
|
||||
# Uncomment the following 2 lines (ss) to log the pattern buffer.
|
||||
# s/^.*$/PATT: &/w debug-lexicon.log
|
||||
# s/^PATT: //
|
||||
#.
|
||||
# Uncomment the following 4 lines (xssx) to log the hold buffer.
|
||||
# x
|
||||
# s/^.*$/HOLD: &/w debug-lexicon.log
|
||||
# s/^HOLD: //
|
||||
# x
|
||||
#.
|
||||
# Tack the hold space to the end of the pattern buffer.
|
||||
G
|
||||
#.
|
||||
# Uncomment the folowing two lines (ss) to log the buffer join.
|
||||
s/^.*$/JOIN: &/w debug-lexicon.log
|
||||
s/^JOIN: //
|
||||
#.
|
||||
# Iterate over alternate lines, matching '<' to '\'
|
||||
:join
|
||||
s,\([^\\ ]*\)\\\n\([^<]*\)<\(@[^}]*[}\\]\)[\n]*,\1\3\2,
|
||||
t join
|
||||
# Clean up stray new lines
|
||||
s/\n//g
|
||||
#.
|
||||
# Clean up special cases
|
||||
#.
|
||||
/@redr/{
|
||||
:cleanredr
|
||||
s/\(redr{[^@]*\)@cmnd{\([^}]*\)}/\1\2/
|
||||
s/\(redr{[^@]*\)@func{\([^}]*\)}/\1\2/
|
||||
s/\(redr{[^@]*\)@sbin{\([^}]*\)}/\1\2/
|
||||
s/\(redr{[^@]*\)@fsfo{\([^}]*\)}/\1\2/
|
||||
t cleanredr
|
||||
}
|
||||
/@fsfo/{
|
||||
:cleanfsfo
|
||||
s/\(fsfo{[^@]*\)@cmnd{\([^}]*\)}/\1\2/
|
||||
s/\(fsfo{[^@]*\)@func{\([^}]*\)}/\1\2/
|
||||
s/\(fsfo{[^@]*\)@sbin{\([^}]*\)}/\1\2/
|
||||
t cleanfsfo
|
||||
}
|
||||
# Character Entities
|
||||
#.
|
||||
# Mark up a few sesitive characters.
|
||||
#.
|
||||
s/</\</g
|
||||
s/>/\>/g
|
||||
#.
|
||||
# Uncomment the folowing two lines (ss) to log the final output, sent to Doxygen.
|
||||
# s/^.*$/OUT : &/w debug-lexicon.log
|
||||
# s/^OUT : //
|
||||
#.
|
||||
# Lines are reassembled, so branch to end
|
||||
b
|
||||
#.
|
||||
# Move protected content to hold space and mark up other entities.
|
||||
:protect
|
||||
h
|
||||
# Clear out any content that has already been marked up, to prevent futher
|
||||
# markup on words that should be left alone.
|
||||
#.
|
||||
:patternflush
|
||||
s/\n<@[^}]*}//
|
||||
s/\n[}]//
|
||||
t patternflush
|
||||
s/\n$//
|
||||
#.
|
||||
# Swap the pattern and hold buffers and remove unmarked lines and extra
|
||||
# characters. Basically the inverse of the 'patternflush' action, with
|
||||
# additional trailing characters stripped.
|
||||
x
|
||||
s/^[ ]*[^<][^@][^}]*$//
|
||||
s/^[ ]*[^<][^@][^\\]*[\\ ()]*\n//
|
||||
:holdflush
|
||||
s/}[)(\\ ][)(\\ ]*/}/
|
||||
s/\n[];)|* ][^\\]*[\\]*//
|
||||
t holdflush
|
||||
s/\n$//
|
||||
#.
|
||||
# Swap the buffers back.
|
||||
x
|
||||
#.
|
||||
# A special case. Tidy up after commands.
|
||||
# Redirectors
|
||||
s/\([^{|] *\)|/\1@redr{|}/g
|
||||
s/\([^{<>^] *\)\([0-9]* *[<>^][<>^]*[a-zA-z0-9._-]*\)/\1@redr{\2}/g
|
||||
s/\\}/}\\/g
|
||||
#.
|
||||
# Now we can add in 'unsafe' entities that would be too greedy.
|
||||
# Declared Variables
|
||||
#:vars
|
||||
s/\([$%][$%]*\)\([A-Za-z_0-9][A-Za-z_0-9]*\)/@vars{@optr{\1}\2}/g
|
||||
#.
|
||||
# Files
|
||||
s/\([A-Za-z*][A-Za-z]*\.[a-z0-9][a-z0-9]*\)/@fsfo{\1}/g
|
||||
#.
|
||||
# Operators
|
||||
# s/\([^^=|+*&%<>{-]\)\([=|+*&%<>^-][|+*&%<>^-]*\)\([^0-9A-Za-z]\)/\1@optr{\2}\3/g
|
||||
#.
|
||||
:commands
|
||||
#.
|
||||
# Manually add a few commands not harvested from source.
|
||||
#.
|
||||
s,[[:<:]]in[[:>:]],@cmnd{in},g
|
||||
s,[[:<:]]whoami[[:>:]],@sbin{whoami},g
|
||||
s,[[:<:]]fishd[[:>:]],@sbin{fishd},g
|
||||
#.
|
||||
#### This section is built in the Makefile. Just some formatting examples. #####
|
||||
#.
|
||||
# fish commands (cmnd) <- 4 character code that has a Doxygen alias counterpart
|
||||
# template : s/[[:<:]]function[[:>:]]/@cmnd{&}/
|
||||
#.
|
||||
# s,[[:<:]]function[[:>:]],@cmnd{function},g
|
||||
# s,[[:<:]]begin[[:>:]],@cmnd{begin},g
|
||||
# ...
|
||||
#.
|
||||
# fish functions (func)
|
||||
# Populated by 'public' functions' filename.
|
||||
#.
|
||||
# s,[[:<:]]fish_pwd[[:>:]],@func{fish_pwd},g
|
||||
# s,[[:<:]]fish_prompt[[:>:]],@func{fish_prompt},g
|
||||
# ...
|
||||
#.
|
||||
# Shell Binary (sbin)
|
||||
# Populated from completion filenames
|
||||
#.
|
||||
# s,[[:<:]]seq[[:>:]],@sbin{seq},g
|
||||
# s,[[:<:]]rm[[:>:]],@sbin{rm},g
|
||||
# ...
|
||||
#.
|
||||
# Color Variable (clrv)
|
||||
# Populated from __fish_config_interactive.fish
|
||||
# Allows fish's 'special' color variables to be identified
|
||||
#.
|
||||
# s,[[:<:]]fish_color_normal[[:>:]],@clrv{fish_color_normal},g
|
||||
# s,[[:<:]]fish_color_command[[:>:]],@clrv{fish_color_command},g
|
||||
#.
|
||||
# Once all of the commands/functions/variables/special's have been marked up,
|
||||
# branch back to tidy up and collapse the pattern/hold buffers back to a
|
||||
# single line.
|
||||
#.
|
||||
# b tidy
|
||||
#.
|
||||
# Colour lookup functions
|
||||
#.
|
||||
# The Makefile will add a table of colour names and values, possibly with
|
||||
# extra style information, that are used to set defaults in the CSS file.
|
|
@ -1,28 +1,31 @@
|
|||
\section fish_prompt fish_prompt - define the appearance of the command line prompt
|
||||
|
||||
\subsection fish_prompt-synopsis Synopsis
|
||||
<pre>function fish_prompt
|
||||
\fish{syn}
|
||||
function fish_prompt
|
||||
...
|
||||
end</pre>
|
||||
end
|
||||
\endfish
|
||||
|
||||
|
||||
\subsection fish_prompt-description Description
|
||||
|
||||
By defining the \c fish_prompt function, the user can choose a custom
|
||||
prompt. The \c fish_prompt function is executed when the prompt is to
|
||||
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.
|
||||
|
||||
The exit status of commands within \c fish_prompt will not modify the value of <a href="index.html#variables-status">$status</a> outside of the \c 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.
|
||||
|
||||
\c fish ships with a number of example prompts that can be chosen with the
|
||||
\c fish_config command.
|
||||
`fish` ships with a number of example prompts that can be chosen with the
|
||||
`fish_config` command.
|
||||
|
||||
\subsection fish_prompt-example Example
|
||||
|
||||
A simple prompt:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function fish_prompt -d "Write out the prompt"
|
||||
printf '\%s\@\%s\%s\%s\%s> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
printf '%s@%s%s%s%s> ' (whoami) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
\section fish_right_prompt fish_right_prompt - define the appearance of the right-side command line prompt
|
||||
|
||||
\subsection fish_right_prompt-synopsis Synopsis
|
||||
<pre>function fish_right_prompt
|
||||
\fish{syn}
|
||||
function fish_right_prompt
|
||||
...
|
||||
end</pre>
|
||||
end
|
||||
\endfish
|
||||
|
||||
\subsection fish_right_prompt-description Description
|
||||
|
||||
\c fish_right_prompt is similar to \c fish_prompt, except that it appears on the right side of the terminal window.
|
||||
`fish_right_prompt` is similar to `fish_prompt`, except that it appears on the right side of the terminal window.
|
||||
|
||||
Multiple lines are not supported in \c fish_right_prompt.
|
||||
Multiple lines are not supported in `fish_right_prompt`.
|
||||
|
||||
\subsection fish_prompt-example Example
|
||||
\subsection fish_right_prompt-example Example
|
||||
|
||||
A simple right prompt:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function fish_right_prompt -d "Write out the right prompt"
|
||||
date "+%m/%d/%y"
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
\subsection fish_update_completions-description Description
|
||||
|
||||
\c fish_update_completions parses manual pages installed on the system, and attempts to create completion files in the \c fish configuration directory.
|
||||
`fish_update_completions` parses manual pages installed on the system, and attempts to create completion files in the `fish` configuration directory.
|
||||
|
||||
This does not overwrite custom completions.
|
||||
|
||||
There are no parameters for <code>fish_update_completions</code>.
|
||||
There are no parameters for `fish_update_completions`.
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
\section for for - perform a set of commands multiple times.
|
||||
|
||||
\subsection for-synopsis Synopsis
|
||||
<tt>for VARNAME in [VALUES...]; COMMANDS...; end</tt>
|
||||
\fish{syn}
|
||||
for VARNAME in [VALUES...]; COMMANDS...; end
|
||||
\endfish
|
||||
|
||||
\subsection for-description Description
|
||||
<tt>for</tt> is a loop construct. It will perform the commands specified by
|
||||
\c COMMANDS multiple times. On each iteration, the environment variable specified by
|
||||
\c VARNAME is assigned a new value from \c VALUES. If \c VALUES is empty, \c COMMANDS will
|
||||
`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.
|
||||
|
||||
\subsection for-example Example
|
||||
\fish
|
||||
for i in foo bar baz; echo $i; end
|
||||
|
||||
The command
|
||||
|
||||
<tt>for i in foo bar baz; echo $i; end</tt>
|
||||
|
||||
would output:
|
||||
|
||||
<pre>
|
||||
# would output:
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
\section funced funced - edit a function interactively
|
||||
|
||||
\subsection funced-synopsis Synopsis
|
||||
<code>funced [OPTIONS] NAME</code>
|
||||
\fish{syn}
|
||||
funced [OPTIONS] NAME
|
||||
\endfish
|
||||
|
||||
\subsection funced-description Description
|
||||
|
||||
\c funced provides an interface to edit the definition of the function
|
||||
<code>NAME</code>.
|
||||
`funced` provides an interface to edit the definition of the function
|
||||
`NAME`.
|
||||
|
||||
If the \c $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.
|
||||
|
||||
If there is no function called \c 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
|
||||
|
||||
- <code>-e command</code> or <code>--editor command</code> 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.
|
||||
- <code>-i</code> or <code>--interactive</code> Open function body in the
|
||||
- `-i` or `--interactive` Open function body in the
|
||||
built-in editor.
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
\section funcsave funcsave - save the definition of a function to the user's autoload directory
|
||||
|
||||
\subsection funcsave-synopsis Synopsis
|
||||
<tt>funcsave FUNCTION_NAME</tt>
|
||||
\fish{syn}
|
||||
funcsave FUNCTION_NAME
|
||||
\endfish
|
||||
|
||||
\subsection funcsave-description Description
|
||||
|
||||
\c 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.
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
\section function function - create a function
|
||||
|
||||
\subsection function-synopsis Synopsis
|
||||
<code>function [OPTIONS] NAME; BODY; end </code>
|
||||
\fish{syn}
|
||||
function [OPTIONS] NAME; BODY; end
|
||||
\endfish
|
||||
|
||||
\subsection function-description Description
|
||||
|
||||
\c function creates a new function \c NAME with the body <code>BODY</code>.
|
||||
`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
|
||||
function is given as a command.
|
||||
|
@ -24,38 +26,38 @@ The following options are available:
|
|||
|
||||
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>
|
||||
<code>$argv</code>. If the \c --argument-names option is provided, the arguments are
|
||||
`$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:
|
||||
|
||||
- \c fish_prompt, which is emitted whenever a new fish prompt is about to be displayed.
|
||||
- \c fish_command_not_found, which is emitted whenever a command lookup failed.
|
||||
- `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.
|
||||
|
||||
\subsection function-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function ll
|
||||
ls -l $argv
|
||||
ls -l $argv
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
will run the \c ls command, using the \c -l option, while passing on any additional files and switches to \c ls.
|
||||
will run the `ls` command, using the `-l` option, while passing on any additional files and switches to `ls`.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function mkdir -d "Create a directory and set CWD"
|
||||
command mkdir $argv
|
||||
if test $status = 0
|
||||
switch $argv[(count $argv)]
|
||||
case '-*'
|
||||
command mkdir $argv
|
||||
if test $status = 0
|
||||
switch $argv[(count $argv)]
|
||||
case '-*'
|
||||
|
||||
case '*'
|
||||
cd $argv[(count $argv)]
|
||||
return
|
||||
end
|
||||
end
|
||||
case '*'
|
||||
cd $argv[(count $argv)]
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
will run the mkdir command, and if it is successful, change the
|
||||
current working directory to the one just created.
|
||||
|
|
|
@ -1,51 +1,53 @@
|
|||
\section functions functions - print or erase functions
|
||||
|
||||
\subsection function-synopsis Synopsis
|
||||
<pre>functions [-n]
|
||||
\subsection functions-synopsis Synopsis
|
||||
\fish{syn}
|
||||
functions [-a|--all] [-n|--names]
|
||||
functions -c OLDNAME NEWNAME
|
||||
functions -d DESCRIPTION FUNCTION
|
||||
functions [-eq] FUNCTIONS...</pre>
|
||||
functions [-eq] FUNCTIONS...
|
||||
\endfish
|
||||
|
||||
\subsection functions-description Description
|
||||
|
||||
\c functions prints or erases functions.
|
||||
`functions` prints or erases functions.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- <code>-a</code> or <code>--all</code> lists all functions, even those whose name start with an underscore.
|
||||
- <code>-c OLDNAME NEWNAME</code> or <code>--copy OLDNAME NEWNAME</code> creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
||||
- <code>-d DESCRIPTION</code> or <code>--description=DESCRIPTION</code> changes the description of this function.
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified functions to be erased.
|
||||
- <code>-h</code> or <code>--help</code> displays a help message and exits.
|
||||
- <code>-n</code> or <code>--names</code> lists the names of all defined functions.
|
||||
- <code>-q</code> or <code>--query</code> tests if the specified functions exist.
|
||||
- `-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.
|
||||
- `-d DESCRIPTION` or `--description=DESCRIPTION` changes the description of this function.
|
||||
- `-e` or `--erase` causes the specified functions to be erased.
|
||||
- `-h` or `--help` displays a help message and exits.
|
||||
- `-n` or `--names` lists the names of all defined functions.
|
||||
- `-q` or `--query` tests if the specified functions exist.
|
||||
|
||||
The default behavior of <code>functions</code>, when called with no arguments,
|
||||
is to print the names of all defined functions. Unless the \c -a option is
|
||||
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.
|
||||
|
||||
If any non-option parameters are given, the definition of the specified
|
||||
functions are printed.
|
||||
|
||||
Automatically loaded functions cannot be removed using <code>functions
|
||||
-e</code>. Either remove the definition file or change the
|
||||
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.
|
||||
|
||||
Copying a function using \c -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.
|
||||
|
||||
Only one function's description can be changed in a single invocation
|
||||
of <code>functions -d</code>.
|
||||
of `functions -d`.
|
||||
|
||||
The exit status of \c functions is the number of functions
|
||||
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 \c -q option.
|
||||
concert with the `-q` option.
|
||||
|
||||
\subsection functions-example Examples
|
||||
|
||||
<code>functions -n</code> displays a list of currently-defined functions.
|
||||
`functions -n` displays a list of currently-defined functions.
|
||||
|
||||
<code>functions -c foo bar</code> copies the \c foo function to a new function called
|
||||
<code>bar</code>.
|
||||
`functions -c foo bar` copies the `foo` function to a new function called
|
||||
`bar`.
|
||||
|
||||
<code>functions -e bar</code> erases the function <code>bar</code>.
|
||||
`functions -e bar` erases the function `bar`.
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
\section help help - display fish documentation
|
||||
|
||||
\subsection help-synopsis Synopsis
|
||||
<tt>help [SECTION]</tt>
|
||||
\fish{syn}
|
||||
help [SECTION]
|
||||
\endfish
|
||||
|
||||
\subsection help-description Description
|
||||
|
||||
\c help displays the fish help documentation.
|
||||
`help` displays the fish help documentation.
|
||||
|
||||
If a \c 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
|
||||
documentation. Otherwise, fish will search for a suitable browser.
|
||||
|
||||
Note that most builtin commands display their help in the terminal when
|
||||
given the <tt>--help</tt> option.
|
||||
given the `--help` option.
|
||||
|
||||
\subsection help-example Example
|
||||
|
||||
<tt>help fg</tt> shows the documentation for the \c fg builtin.
|
||||
`help fg` shows the documentation for the `fg` builtin.
|
||||
|
|
|
@ -8,13 +8,13 @@ history (--search | --delete ) (--prefix "prefix string" | --contains "search st
|
|||
|
||||
\subsection history-description Description
|
||||
|
||||
\c history is used to list, search and delete the history of commands used.
|
||||
`history` is used to list, search and delete the history of commands used.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c --save saves all changes in the history file. The shell automatically
|
||||
- `--save` saves all changes in the history file. The shell automatically
|
||||
saves the history file; this option is provided for internal use.
|
||||
- \c --clear clears the history file. A prompt is displayed before the history
|
||||
- `--clear` clears the history file. A prompt is displayed before the history
|
||||
is erased.
|
||||
- \c --merge immediately incorporates history changes from other sessions. Ordinarily
|
||||
fish ignores history changes from sessions started after the current one. This command
|
||||
|
@ -24,24 +24,24 @@ applies those changes immediately.
|
|||
- \c --delete deletes history items.
|
||||
- \c --prefix searches or deletes items in the history that begin with the
|
||||
specified text string.
|
||||
- \c --contains searches or deletes items in the history that contain the
|
||||
- `--contains` searches or deletes items in the history that contain the
|
||||
specified text string.
|
||||
|
||||
If \c --search is specified without \c --contains or <code>--prefix</code>,
|
||||
\c --contains will be assumed.
|
||||
If `--search` is specified without `--contains` or `--prefix`,
|
||||
`--contains` will be assumed.
|
||||
|
||||
If \c --delete is specified without \c --contains or <code>--prefix</code>,
|
||||
If `--delete` is specified without `--contains` or `--prefix`,
|
||||
only a history item which exactly matches the parameter will be erased. No
|
||||
prompt will be given. If \c --delete is specified with either of these
|
||||
prompt will be given. If `--delete` is specified with either of these
|
||||
parameters, an interactive prompt will be displayed before any items are
|
||||
deleted.
|
||||
|
||||
\subsection history-examples Example
|
||||
|
||||
<code>history --clear</code> deletes all history items
|
||||
`history --clear` deletes all history items
|
||||
|
||||
<code>history --search --contains "foo"</code> outputs a list of all previous
|
||||
`history --search --contains "foo"` outputs a list of all previous
|
||||
commands containing the string "foo".
|
||||
|
||||
<code>history --delete --prefix "foo"</code> interactively deletes the record
|
||||
`history --delete --prefix "foo"` interactively deletes the record
|
||||
of previous commands which start with "foo".
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
\section if if - conditionally execute a command
|
||||
|
||||
\subsection if-synopsis Synopsis
|
||||
<tt>if CONDITION; COMMANDS_TRUE...; [else if CONDITION2; COMMANDS_TRUE2...;] [else; COMMANDS_FALSE...;] end</tt>
|
||||
\fish{syn}
|
||||
if CONDITION; COMMANDS_TRUE...; [else if CONDITION2; COMMANDS_TRUE2...;] [else; COMMANDS_FALSE...;] end
|
||||
\endfish
|
||||
|
||||
\subsection if-description Description
|
||||
|
||||
<tt>if</tt> will execute the command \c CONDITION. If the condition's
|
||||
exit status is 0, the commands \c COMMANDS_TRUE will execute. If the
|
||||
exit status is not 0 and <tt>else</tt> is given, \c COMMANDS_FALSE will
|
||||
`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.
|
||||
|
||||
In order to use the exit status of multiple commands as the condition
|
||||
of an if block, use <a href="#begin"><tt>begin; ...; end</tt></a> and
|
||||
the short circuit commands <a href="commands.html#and"><tt>and</tt></a>
|
||||
and <a href="commands.html#or"><tt>or</tt></a>.
|
||||
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>.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
|
@ -21,16 +23,18 @@ variable.
|
|||
|
||||
\subsection if-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
if test -f foo.txt
|
||||
echo foo.txt exists
|
||||
echo foo.txt exists
|
||||
else if test -f bar.txt
|
||||
echo bar.txt exists
|
||||
echo bar.txt exists
|
||||
else
|
||||
echo foo.txt and bar.txt do not exist
|
||||
echo foo.txt and bar.txt do not exist
|
||||
end
|
||||
</pre>will print <tt>foo.txt exists</tt> if the file foo.txt
|
||||
\endfish
|
||||
|
||||
will print `foo.txt exists` if the file foo.txt
|
||||
exists and is a regular file, otherwise it will print
|
||||
<tt>bar.txt exists</tt> if the file bar.txt exists
|
||||
`bar.txt exists` if the file bar.txt exists
|
||||
and is a regular file, otherwise it will print
|
||||
<tt>foo.txt and bar.txt do not exist</tt>.
|
||||
`foo.txt and bar.txt do not exist`.
|
||||
|
|
1313
doc_src/index.hdr.in
1313
doc_src/index.hdr.in
File diff suppressed because it is too large
Load diff
|
@ -1,29 +1,33 @@
|
|||
\section isatty isatty - test if a file or file descriptor is a tty.
|
||||
|
||||
\subsection isatty-synopsis Synopsis
|
||||
<tt>isatty [FILE | DEVICE | FILE DESCRIPTOR NUMBER]</tt>
|
||||
\fish{syn}
|
||||
isatty [FILE | DEVICE | FILE DESCRIPTOR NUMBER]
|
||||
\endfish
|
||||
|
||||
\subsection isatty-description Description
|
||||
<tt>isatty</tt> tests if a file or file descriptor is a tty.
|
||||
`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, <tt>standard input</tt> 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.
|
||||
|
||||
\subsection isatty-examples Examples
|
||||
|
||||
From an interactive shell, the commands below exit with a return value of zero:
|
||||
<pre>
|
||||
|
||||
\fish
|
||||
isatty
|
||||
isatty stdout
|
||||
isatty 2
|
||||
echo | isatty /dev/fd/1
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
And these will exit non-zero:
|
||||
<pre>
|
||||
|
||||
\fish
|
||||
echo | isatty
|
||||
isatty /dev/fd/9
|
||||
isatty stdout > file
|
||||
isatty 2 2> file
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
\section jobs jobs - print currently running jobs
|
||||
|
||||
\subsection jobs-synopsis Synopsis
|
||||
<code>jobs [OPTIONS] [PID]</code>
|
||||
\fish{syn}
|
||||
jobs [OPTIONS] [PID]
|
||||
\endfish
|
||||
|
||||
\subsection jobs-description Description
|
||||
<code>jobs</code> prints a list of the currently
|
||||
`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:
|
||||
|
||||
- <code>-c</code> or <code>--command</code> prints the command name for each process in jobs.
|
||||
- <code>-g</code> or <code>--group</code> only prints the group ID of each job.
|
||||
- <code>-h</code> or <code>--help</code> displays a help message and exits.
|
||||
- <code>-l</code> or <code>--last</code> prints only the last job to be started.
|
||||
- <code>-p</code> or <code>--pid</code> prints the process ID for each process in all jobs.
|
||||
- `-c` or `--command` prints the command name for each process in jobs.
|
||||
- `-g` or `--group` only prints the group ID of each job.
|
||||
- `-h` or `--help` displays a help message and exits.
|
||||
- `-l` or `--last` prints only the last job to be started.
|
||||
- `-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
|
||||
of each job since the last command was executed. The CPU usage is
|
||||
|
@ -22,4 +24,4 @@ multiprocessor systems, the total activity may be more than 100\%.
|
|||
|
||||
\subsection jobs-example Example
|
||||
|
||||
<code>jobs</code> outputs a summary of the current jobs.
|
||||
`jobs` outputs a summary of the current jobs.
|
||||
|
|
2035
doc_src/license.hdr
2035
doc_src/license.hdr
File diff suppressed because it is too large
Load diff
|
@ -2,11 +2,13 @@
|
|||
\section math math - Perform mathematics calculations
|
||||
|
||||
\subsection math-synopsis Synopsis
|
||||
<tt>math EXPRESSION</tt>
|
||||
\fish{syn}
|
||||
math EXPRESSION
|
||||
\endfish
|
||||
|
||||
\subsection math-description Description
|
||||
|
||||
\c 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.
|
||||
|
@ -20,7 +22,7 @@ have to be escaped.
|
|||
|
||||
\subsection math-example Examples
|
||||
|
||||
<code>math 1+1</code> outputs 2.
|
||||
`math 1+1` outputs 2.
|
||||
|
||||
<code>math $status-128</code> outputs the numerical exit status of the
|
||||
`math $status-128` outputs the numerical exit status of the
|
||||
last command minus 128.
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
\section mimedb mimedb - lookup file information via the mime database
|
||||
|
||||
\subsection mimedb-synopsis Synopsis
|
||||
<tt>mimedb [OPTIONS] FILES...</tt>
|
||||
\fish{syn}
|
||||
mimedb [OPTIONS] FILES...
|
||||
\endfish
|
||||
|
||||
\subsection mimedb-description Description
|
||||
|
||||
\c mimedb queries the MIME type database and the \c .desktop files
|
||||
\c mimedb queries the MIME type database and the `.desktop` files
|
||||
installed on the system in order to find information on
|
||||
the files listed in <code>FILES</code>. The information that \c mimedb
|
||||
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. \c mimedb can also
|
||||
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:
|
||||
|
||||
- \c -t, \c --input-file-data determines the files' type both by their filename and by their contents (default behaviour).
|
||||
- \c -f, \c --input-filename determines the files' type by their filename.
|
||||
- \c -i, \c --input-mime specifies that the arguments are not files, but MIME types.
|
||||
- \c -m, \c --output-mime outputs the MIME type of each file (default behaviour).
|
||||
- \c -f, \c --output-description outputs the description of each MIME type.
|
||||
- \c -a, \c --output-action outputs the default action of each MIME type.
|
||||
- \c -l, \c --launch launches the default action for the specified files.
|
||||
- \c -h, \c --help displays a help message and exit.
|
||||
- \c -v, \c --version displays the version number and exits.
|
||||
- `-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.
|
||||
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
\section nextd nextd - move forward through directory history
|
||||
|
||||
\subsection nextd-synopsis Synopsis
|
||||
<tt>nextd [-l | --list] [POS]</tt>
|
||||
\fish{syn}
|
||||
nextd [ -l | --list ] [POS]
|
||||
\endfish
|
||||
|
||||
\subsection nextd-description Description
|
||||
<tt>nextd</tt> moves forwards <tt>POS</tt> positions in the history of visited
|
||||
`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 <code>-l></code> or <code>--list</code> flag is specified, the current
|
||||
If the `-l` or `--list` flag is specified, the current
|
||||
directory history is also displayed.
|
||||
|
||||
\subsection nextd-example Example
|
||||
|
||||
\code
|
||||
\fish
|
||||
cd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
|
||||
cd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
|
||||
prevd
|
||||
# Working directory is now /usr/src
|
||||
|
||||
nextd
|
||||
# Working directory is now /usr/src/fish-shell</pre>
|
||||
\endcode
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
\endfish
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
\section not not - negate the exit status of a job
|
||||
|
||||
\subsection not-synopsis Synopsis
|
||||
<tt>not COMMAND [OPTIONS...]</tt>
|
||||
\fish{syn}
|
||||
not COMMAND [OPTIONS...]
|
||||
\endfish
|
||||
|
||||
\subsection not-description Description
|
||||
|
||||
\c not negates the exit status of another command. If the exit status
|
||||
is zero, \c not returns 1. Otherwise, \c not returns 0.
|
||||
`not` negates the exit status of another command. If the exit status
|
||||
is zero, `not` returns 1. Otherwise, `not` returns 0.
|
||||
|
||||
\subsection not-example Example
|
||||
|
||||
The following code reports an error and exits if no file named spoon can be found.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
if not test -f spoon
|
||||
echo There is no spoon
|
||||
exit 1
|
||||
echo There is no spoon
|
||||
exit 1
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
\section open open - open file in its default application
|
||||
|
||||
\subsection open-synopsis Synopsis
|
||||
<tt>open FILES...</tt>
|
||||
\fish{syn}
|
||||
open FILES...
|
||||
\endfish
|
||||
|
||||
\subsection open-description Description
|
||||
|
||||
\c open opens a file in its default application, using the \c 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
|
||||
|
||||
<tt>open *.txt</tt> 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.
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
\section or or - conditionally execute a command
|
||||
|
||||
\subsection or-synopsis Synopsis
|
||||
<tt>COMMAND1; or COMMAND2</tt>
|
||||
\fish{syn}
|
||||
COMMAND1; or COMMAND2
|
||||
\endfish
|
||||
|
||||
\subsection or-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
\c 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
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
|
@ -16,12 +18,12 @@ variable.
|
|||
|
||||
\subsection or-example Example
|
||||
|
||||
The following code runs the \c 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,
|
||||
<tt>make clean</tt> is run, which removes the files created by the
|
||||
`make clean` is run, which removes the files created by the
|
||||
build process.
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
make; and make install; or make clean
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
|
|
@ -1,24 +1,28 @@
|
|||
\section popd popd - move through directory stack
|
||||
|
||||
\subsection popd-synopsis Synopsis
|
||||
<tt>popd</tt>
|
||||
\fish{syn}
|
||||
popd
|
||||
\endfish
|
||||
|
||||
\subsection popd-description Description
|
||||
|
||||
<tt>popd</tt> 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"><tt>pushd</tt></a> to add directories to the stack.
|
||||
href="#pushd">`pushd`</a> to add directories to the stack.
|
||||
|
||||
\subsection popd-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
pushd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
|
||||
pushd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
# Directory stack contains /usr/src /usr/src/fish-shell
|
||||
|
||||
popd
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,26 +1,31 @@
|
|||
\section prevd prevd - move backward through directory history
|
||||
|
||||
\subsection prevd-synopsis Synopsis
|
||||
<tt>prevd [-l | --list] [POS]</tt>
|
||||
\fish{syn}
|
||||
prevd [ -l | --list ] [POS]
|
||||
\endfish
|
||||
|
||||
\subsection prevd-description Description
|
||||
|
||||
<tt>prevd</tt> moves backwards <tt>POS</tt> 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.
|
||||
|
||||
If the <code>-l</code> or <code>--list</code> flag is specified, the current
|
||||
If the `-l` or `--list` flag is specified, the current
|
||||
history is also displayed.
|
||||
|
||||
\subsection prevd-example Example
|
||||
|
||||
\code
|
||||
\fish
|
||||
cd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
|
||||
cd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
|
||||
prevd
|
||||
# Working directory is now /usr/src
|
||||
|
||||
nextd
|
||||
# Working directory is now /usr/src/fish-shell</pre>
|
||||
\endcode
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
\endfish
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
\section psub psub - perform process substitution
|
||||
|
||||
\subsection psub-synopsis Synopsis
|
||||
<tt>COMMAND1 (COMMAND2|psub [-f]) </tt>
|
||||
\fish{syn}
|
||||
COMMAND1 (COMMAND2|psub [-f])
|
||||
\endfish
|
||||
|
||||
\subsection psub-description Description
|
||||
|
||||
|
@ -11,16 +13,16 @@ 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. \c psub combined with a
|
||||
program. `psub` combined with a
|
||||
regular command substitution provides the same functionality.
|
||||
|
||||
If the \c -f or \c --file switch is given to <tt>psub</tt>, \c psub will use a
|
||||
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 \c psub to be significantly slower when large
|
||||
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
|
||||
|
||||
<tt>diff (sort a.txt|psub) (sort b.txt|psub)</tt> shows the difference
|
||||
`diff (sort a.txt|psub) (sort b.txt|psub)` shows the difference
|
||||
between the sorted versions of files a.txt and b.txt.
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
\section pushd pushd - push directory to directory stack
|
||||
|
||||
\subsection pushd-synopsis Synopsis
|
||||
<tt>pushd [DIRECTORY]</tt>
|
||||
\fish{syn}
|
||||
pushd [DIRECTORY]
|
||||
\endfish
|
||||
|
||||
\subsection pushd-description Description
|
||||
The <tt>pushd</tt> function adds \c DIRECTORY to the top of the directory stack
|
||||
and makes it the current working directory. <a href="#popd"><tt>popd</tt></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.
|
||||
|
||||
\subsection pushd-example Example
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
pushd /usr/src
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
|
||||
pushd /usr/src/fish-shell
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
# Directory stack contains /usr/src /usr/src/fish-shell
|
||||
|
||||
popd
|
||||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
\section pwd pwd - output the current working directory
|
||||
|
||||
\subsection pwd-synopsis Synopsis
|
||||
<tt>pwd</tt>
|
||||
\fish{syn}
|
||||
pwd
|
||||
\endfish
|
||||
|
||||
\subsection pwd-description Description
|
||||
|
||||
\c pwd outputs (prints) the current working directory.
|
||||
`pwd` outputs (prints) the current working directory.
|
||||
|
||||
Note that \c fish always resolves symbolic links in the current directory path.
|
||||
Note that `fish` always resolves symbolic links in the current directory path.
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
\section random random - generate random number
|
||||
|
||||
\subsection random-synopsis Synopsis
|
||||
<tt>random [SEED]</tt>
|
||||
\fish{syn}
|
||||
random [SEED]
|
||||
\endfish
|
||||
|
||||
\subsection random-description Description
|
||||
|
||||
\c random outputs a random number from 0 to 32766, inclusive.
|
||||
`random` outputs a random number from 0 to 32766, inclusive.
|
||||
|
||||
If a \c 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
|
||||
|
@ -17,9 +19,9 @@ seeding it, the current time will be used as the seed.
|
|||
|
||||
The following code will count down from a random number to 1:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
for i in (seq (random) -1 1)
|
||||
echo $i
|
||||
sleep
|
||||
echo $i
|
||||
sleep
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
\section read read - read line of input into variables
|
||||
|
||||
\subsection read-synopsis Synopsis
|
||||
<tt>read [OPTIONS] [VARIABLES...]</tt>
|
||||
\fish{syn}
|
||||
read [OPTIONS] [VARIABLES...]
|
||||
\endfish
|
||||
|
||||
\subsection read-description Description
|
||||
|
||||
<tt>read</tt> reads one line from standard
|
||||
`read` reads one line from standard
|
||||
input and stores the result in one or more shell variables.
|
||||
|
||||
The following options are available:
|
||||
|
@ -31,12 +33,12 @@ input is considered a separate token.
|
|||
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.
|
||||
|
||||
See the documentation for \c set for more details on the scoping rules for
|
||||
See the documentation for `set` for more details on the scoping rules for
|
||||
variables.
|
||||
|
||||
\subsection read-example Example
|
||||
|
||||
The following code stores the value 'hello' in the shell variable
|
||||
<tt>$foo</tt>.
|
||||
`$foo`.
|
||||
|
||||
<tt>echo hello|read foo</tt>
|
||||
`echo hello|read foo`
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
\section return return - stop the current inner function
|
||||
|
||||
\subsection return-synopsis Synopsis
|
||||
<tt>function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end</tt>
|
||||
\fish{syn}
|
||||
function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end
|
||||
\endfish
|
||||
|
||||
\subsection return-description Description
|
||||
|
||||
\c return halts a currently running function. The exit status is set
|
||||
to \c STATUS if it is given.
|
||||
`return` halts a currently running function. The exit status is set
|
||||
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>
|
||||
|
@ -17,10 +19,10 @@ function.
|
|||
\subsection return-example Example
|
||||
The following code is an implementation of the false command as a fish function
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
function false
|
||||
return 1
|
||||
return 1
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
\section set set - display and change shell variables.
|
||||
|
||||
\subsection set-synopsis Synopsis
|
||||
<pre>
|
||||
\fish{syn}
|
||||
set [SCOPE_OPTIONS]
|
||||
set [OPTIONS] VARIABLE_NAME VALUES...
|
||||
set [OPTIONS] VARIABLE_NAME[INDICES]... VALUES...
|
||||
set (-q | --query) [SCOPE_OPTIONS] VARIABLE_NAMES...
|
||||
set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME
|
||||
set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
||||
</pre>
|
||||
set (-q | \--query) [SCOPE_OPTIONS] VARIABLE_NAMES...
|
||||
set (-e | \--erase) [SCOPE_OPTIONS] VARIABLE_NAME
|
||||
set (-e | \--erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
||||
\endfish
|
||||
|
||||
\subsection set-description Description
|
||||
|
||||
<code>set</code> manipulates <a href="index.html#variables">shell
|
||||
`set` manipulates <a href="index.html#variables">shell
|
||||
variables</a>.
|
||||
|
||||
If set is called with no arguments, the names and values of all
|
||||
|
@ -20,31 +20,31 @@ 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, \c set assigns the variable
|
||||
<code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
|
||||
With both variable names and values provided, `set` assigns the variable
|
||||
`VARIABLE_NAME` the values `VALUES...`.
|
||||
|
||||
The following options control variable scope:
|
||||
- <code>-l</code> or <code>--local</code> forces the specified shell variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
|
||||
- <code>-g</code> or <code>--global</code> causes the specified shell variable to be given a global scope. Non-global variables disappear when the block they belong to ends
|
||||
- <code>-U</code> or <code>--universal</code> causes the specified shell variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
|
||||
- <code>-x</code> or <code>--export</code> causes the specified shell variable to be exported to child processes (making it an "environment variable")
|
||||
- <code>-u</code> or <code>--unexport</code> causes the specified shell variable to NOT be exported to child processes
|
||||
- `-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
|
||||
- `-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")
|
||||
- `-u` or `--unexport` causes the specified shell variable to NOT be exported to child processes
|
||||
|
||||
The following options are available:
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified shell variable to be erased
|
||||
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
|
||||
- <code>-n</code> or <code>--names</code> List only the names of all defined variables, not their value
|
||||
- <code>-L</code> or <code>--long</code> do not abbreviate long values when printing set variables
|
||||
- `-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.
|
||||
- `-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
|
||||
|
||||
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
|
||||
<code>PATH[1 3 7]</code>, only those array elements specified will be
|
||||
changed. When array indices are specified to \c set, multiple arguments
|
||||
may be used to specify additional indexes, e.g. <code>set PATH[1]
|
||||
PATH[4] /bin /sbin</code>. If you specify a negative index when
|
||||
`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.
|
||||
|
@ -53,7 +53,7 @@ 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 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 \c -l or \c --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:
|
||||
|
@ -67,32 +67,34 @@ In query mode, the scope to be examined can be specified.
|
|||
In erase mode, if variable indices are specified, only the specified
|
||||
slices of the array variable will be erased.
|
||||
|
||||
\c set requires all options to come before any
|
||||
other arguments. For example, <code>set flags -l</code> will have
|
||||
the effect of setting the value of the variable <code>flags</code> to
|
||||
`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.
|
||||
|
||||
In assignment mode, \c set exits with a non-zero exit status if variable
|
||||
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. <code>if set output
|
||||
(command)</code>. In query mode, the exit status is the number of variables that
|
||||
were not found. In erase mode, \c set exits with a zero exit status in case of
|
||||
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
|
||||
|
||||
<code>set -xg</code> will print all global, exported variables.
|
||||
`set -xg` will print all global, exported variables.
|
||||
|
||||
<code>set foo hi</code> sets the value of the variable foo to be hi.
|
||||
`set foo hi` sets the value of the variable foo to be hi.
|
||||
|
||||
<code>set -e smurf</code> removes the variable \c smurf.
|
||||
`set -e smurf` removes the variable `smurf`.
|
||||
|
||||
<code>set PATH[4] ~/bin</code> changes the fourth element of the \c PATH array to \c ~/bin
|
||||
`set PATH[4] ~/bin` changes the fourth element of the `PATH` array to `~/bin`
|
||||
|
||||
<pre>if set python_path (which python)
|
||||
\fish
|
||||
if set python_path (which python)
|
||||
echo "Python is at $python_path"
|
||||
end</pre>
|
||||
end
|
||||
\endfish
|
||||
|
||||
The above outputs the path to Python if \c which returns true.
|
||||
The above outputs the path to Python if `which` returns true.
|
||||
|
|
|
@ -1,44 +1,48 @@
|
|||
\section set_color set_color - set the terminal color
|
||||
|
||||
\subsection set_color-synopsis Synopsis
|
||||
<tt>set_color [-h --help] [-b --background COLOR] [COLOR]</tt>
|
||||
\fish{syn}
|
||||
set_color [-h|--help] [-b|--background COLOR] [COLOR]
|
||||
\endfish
|
||||
|
||||
\subsection set_color-description Description
|
||||
|
||||
\c set_color changes the foreground and/or background color of the terminal.
|
||||
\c COLOR is one of black, red, green, brown, yellow, blue, magenta,
|
||||
`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.
|
||||
|
||||
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. \c fish will choose the closest supported color.
|
||||
as A0FF33 or f2f. `fish` will choose the closest supported color.
|
||||
|
||||
The following options are available:
|
||||
|
||||
- \c -b, \c --background \c COLOR sets the background color.
|
||||
- \c -c, \c --print-colors prints a list of all valid color names.
|
||||
- \c -h, \c --help displays a help message and exit.
|
||||
- \c -o, \c --bold sets bold or extra bright mode.
|
||||
- \c -u, \c --underline sets underlined mode.
|
||||
- `-b`, `--background` `COLOR` sets the background color.
|
||||
- `-c`, `--print-colors` prints a list of all valid color names.
|
||||
- `-h`, `--help` displays a help message and exit.
|
||||
- `-o`, `--bold` sets bold or extra bright mode.
|
||||
- `-u`, `--underline` sets underlined mode.
|
||||
|
||||
Calling <tt>set_color normal</tt> will set the terminal color to
|
||||
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
|
||||
color set. On such terminals, <code>set_color white</code> will result
|
||||
in a grey font color, while <code>set_color --bold white</code> 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.
|
||||
|
||||
Not all terminal emulators support all these features.
|
||||
|
||||
\c 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.
|
||||
|
||||
\subsection set_color-example Examples
|
||||
<pre>set_color red; echo "Roses are red"
|
||||
|
||||
\fish
|
||||
set_color red; echo "Roses are red"
|
||||
set_color blue; echo "Violets are blue"
|
||||
set_color 62A ; echo "Eggplants are dark purple"
|
||||
set_color normal; echo "Normal is nice too"
|
||||
</pre>
|
||||
\endfish
|
||||
|
|
|
@ -1,30 +1,32 @@
|
|||
\section source source - evaluate contents of file.
|
||||
|
||||
\subsection source-synopsis Synopsis
|
||||
<tt>source FILENAME [ARGUMENTS...]</tt>
|
||||
\fish{syn}
|
||||
source FILENAME [ARGUMENTS...]
|
||||
\endfish
|
||||
|
||||
\subsection source-description Description
|
||||
|
||||
\c 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. <tt>fish < FILENAME</tt>) since the commands will be
|
||||
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.
|
||||
|
||||
The return status of \c 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,
|
||||
\c source exits with a non-zero status.
|
||||
`source` exits with a non-zero status.
|
||||
|
||||
\c . (a single period) is an alias for the \c source command. The use of \c .
|
||||
is deprecated in favour of \c source, and \c . will be removed in a future
|
||||
`.` (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
|
||||
|
||||
<tt>source ~/.config/fish/config.fish</tt> causes fish to re-read its initialization file.
|
||||
`source ~/.config/fish/config.fish` causes fish to re-read its initialization file.
|
||||
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
\section status status - query fish runtime information
|
||||
|
||||
\subsection status-synopsis Synopsis
|
||||
<tt>status [OPTION]</tt>
|
||||
\fish{syn}
|
||||
status [OPTION]
|
||||
\endfish
|
||||
|
||||
\subsection status-description Description
|
||||
With no arguments, <tt>status</tt> 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:
|
||||
- <tt>-c</tt> or <tt>--is-command-substitution</tt> returns 0 if fish is currently executing a command substitution.
|
||||
- <tt>-b</tt> or <tt>--is-block</tt> returns 0 if fish is currently executing a block of code.
|
||||
- <tt>-i</tt> or <tt>--is-interactive</tt> returns 0 if fish is interactive - that is, connected to a keyboard.
|
||||
- <tt>-l</tt> or <tt>--is-login</tt> returns 0 if fish is a login shell - that is, if fish should perform login tasks such as setting up the PATH.
|
||||
- <tt>--is-full-job-control</tt> returns 0 if full job control is enabled.
|
||||
- <tt>--is-interactive-job-control</tt> returns 0 if interactive job control is enabled.
|
||||
- <tt>--is-no-job-control</tt> returns 0 if no job control is enabled.
|
||||
- <tt>-f</tt> or <tt>--current-filename</tt> prints the filename of the currently running script.
|
||||
- <tt>-n</tt> or <tt>--current-line-number</tt> prints the line number of the currently running script.
|
||||
- <tt>-j CONTROLTYPE</tt> or <tt>--job-control=CONTROLTYPE</tt> sets the job control type, which can be <tt>none</tt>, <tt>full</tt>, or <tt>interactive</tt>.
|
||||
- <tt>-t</tt> or <tt>--print-stack-trace</tt> prints a stack trace of all function calls on the call stack.
|
||||
- <tt>-h</tt> or <tt>--help</tt> displays a help message and exit.
|
||||
- `-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.
|
||||
- `-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.
|
||||
- `--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-no-job-control` returns 0 if no job control is enabled.
|
||||
- `-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.
|
||||
- `-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.
|
||||
- `-h` or `--help` displays a help message and exit.
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
\section switch switch - conditionally execute a block of commands
|
||||
|
||||
\subsection switch-synopsis Synopsis
|
||||
<tt>switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end</tt>
|
||||
\fish{syn}
|
||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||
\endfish
|
||||
|
||||
\subsection switch-description Description
|
||||
|
||||
\c switch performs one of several blocks of commands, depending on whether
|
||||
a specified value equals one of several wildcarded values. \c case is used
|
||||
together with the \c switch statement in order to determine which block should
|
||||
`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.
|
||||
|
||||
Each \c case command is given one or more parameters. The first \c 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. \c case parameters may contain
|
||||
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.
|
||||
|
||||
|
@ -29,7 +31,7 @@ against the parameter.
|
|||
If the variable \$animal contains the name of an animal, the following
|
||||
code would attempt to classify it:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
switch $animal
|
||||
case cat
|
||||
echo evil
|
||||
|
@ -42,8 +44,8 @@ switch $animal
|
|||
case '*'
|
||||
echo I have no idea what a $animal is
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
If the above code was run with \c \$animal set to \c whale, the output
|
||||
would be \c mammal.
|
||||
If the above code was run with `$animal` set to `whale`, the output
|
||||
would be `mammal`.
|
||||
|
||||
|
|
108
doc_src/test.txt
108
doc_src/test.txt
|
@ -1,7 +1,9 @@
|
|||
\section test test - perform tests on files and text
|
||||
|
||||
\subsection test-synopsis Synopsis
|
||||
<tt>test [EXPRESSION]</tt>
|
||||
\fish{syn}
|
||||
test [EXPRESSION]
|
||||
\endfish
|
||||
|
||||
\subsection test-description Description
|
||||
|
||||
|
@ -10,68 +12,68 @@ and 1 if false. An expression is made up of one or more operators
|
|||
and their arguments.
|
||||
|
||||
The following operators are available to examine files and directories:
|
||||
- <tt>-b FILE</tt> returns true if \c FILE is a block device.
|
||||
- <tt>-c FILE</tt> returns true if \c FILE is a character device.
|
||||
- <tt>-d FILE</tt> returns true if \c FILE is a directory.
|
||||
- <tt>-e FILE</tt> returns true if \c FILE exists.
|
||||
- <tt>-f FILE</tt> returns true if \c FILE is a regular file.
|
||||
- <tt>-g FILE</tt> returns true if \c FILE has the set-group-ID bit set.
|
||||
- <tt>-G FILE</tt> returns true if \c FILE exists and has the same group ID
|
||||
- `-b FILE` returns true if `FILE` is a block device.
|
||||
- `-c FILE` returns true if `FILE` is a character device.
|
||||
- `-d FILE` returns true if `FILE` is a directory.
|
||||
- `-e FILE` returns true if `FILE` exists.
|
||||
- `-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` exists and has the same group ID
|
||||
as the current user.
|
||||
- <tt>-L FILE</tt> returns true if \c FILE is a symbolic link.
|
||||
- <tt>-O FILE</tt> returns true if \c FILE exists and is owned by the current
|
||||
- `-L FILE` returns true if `FILE` is a symbolic link.
|
||||
- `-O FILE` returns true if `FILE` exists and is owned by the current
|
||||
user.
|
||||
- <tt>-p FILE</tt> returns true if \c FILE is a named pipe.
|
||||
- <tt>-r FILE</tt> returns true if \c FILE is marked as readable.
|
||||
- <tt>-s FILE</tt> returns true if the size of \c FILE is greater than zero.
|
||||
- <tt>-S FILE</tt> returns true if \c FILE is a socket.
|
||||
- <tt>-t FD</tt> returns true if the file descriptor \c FD is a terminal (TTY).
|
||||
- <tt>-u FILE</tt> returns true if \c FILE has the set-user-ID bit set.
|
||||
- <tt>-w FILE</tt> returns true if \c FILE is marked as writable; note that this does not check if the filesystem is read-only.
|
||||
- <tt>-x FILE</tt> returns true if \c FILE is marked as executable.
|
||||
- `-p FILE` returns true if `FILE` is a named pipe.
|
||||
- `-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 `FILE` is a socket.
|
||||
- `-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.
|
||||
- `-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.
|
||||
|
||||
The following operators are available to compare and examine text strings:
|
||||
- <tt>STRING1 = STRING2</tt> returns true if the strings \c STRING1 and
|
||||
\c STRING2 are identical.
|
||||
- <tt>STRING1 != STRING2</tt> returns true if the strings \c STRING1 and
|
||||
\c STRING2 are not identical.
|
||||
- <tt>-n STRING</tt> returns true if the length of \c STRING is non-zero.
|
||||
- <tt>-z STRING</tt> returns true if the length of \c STRING is zero.
|
||||
- `STRING1 = STRING2` returns true if the strings `STRING1` and
|
||||
`STRING2` are identical.
|
||||
- `STRING1 != STRING2` returns true if the strings `STRING1` and
|
||||
`STRING2` are not identical.
|
||||
- `-n STRING` returns true if the length of `STRING` is non-zero.
|
||||
- `-z STRING` returns true if the length of `STRING` is zero.
|
||||
|
||||
The following operators are available to compare and examine numbers:
|
||||
- <tt>NUM1 -eq NUM2</tt> returns true if \c NUM1 and \c NUM2 are numerically equal.
|
||||
- <tt>NUM1 -ne NUM2</tt> returns true if \c NUM1 and \c NUM2 are not numerically equal.
|
||||
- <tt>NUM1 -gt NUM2</tt> returns true if \c NUM1 is greater than <tt>NUM2</tt>.
|
||||
- <tt>NUM1 -ge NUM2</tt> returns true if \c NUM1 is greater than or equal to <tt>NUM2</tt>.
|
||||
- <tt>NUM1 -lt NUM2</tt> returns true if \c NUM1 is less than <tt>NUM2</tt>.
|
||||
- <tt>NUM1 -le NUM2</tt> returns true if \c NUM1 is less than or equal to <tt>NUM2</tt>.
|
||||
- `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 -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 -lt NUM2` returns true if `NUM1` is less than `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
|
||||
operations, including fractions, the \c env program may be useful. Consult the
|
||||
operations, including fractions, the `env` program may be useful. Consult the
|
||||
documentation for your operating system.
|
||||
|
||||
Expressions can be combined using the following operators:
|
||||
- <tt>COND1 -a COND2</tt> returns true if both \c COND1 and \c COND2 are true.
|
||||
- <tt>COND1 -o COND2</tt> returns true if either \c COND1 or \c 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.
|
||||
|
||||
Expressions can be inverted using the \c ! operator:
|
||||
- <tt>! EXPRESSION</tt> returns true if \c EXPRESSION is false, and false if
|
||||
\c EXPRESSION is true.
|
||||
Expressions can be inverted using the `!` operator:
|
||||
- `! EXPRESSION` returns true if `EXPRESSION` is false, and false if
|
||||
`EXPRESSION` is true.
|
||||
|
||||
Expressions can be grouped using parentheses.
|
||||
- <tt>( EXPRESSION )</tt> returns the value of <tt>EXPRESSION</tt>.
|
||||
Note that parentheses will usually require escaping with <tt>\\(</tt> to avoid
|
||||
- `( EXPRESSION )` returns the value of `EXPRESSION`.
|
||||
Note that parentheses will usually require escaping with `\\(` to avoid
|
||||
being interpreted as a command substitution.
|
||||
|
||||
\subsection test-example Examples
|
||||
|
||||
If the \c /tmp directory exists, copy the \c /etc/motd file to it:
|
||||
If the `/tmp` directory exists, copy the `/etc/motd` file to it:
|
||||
|
||||
<pre>
|
||||
\fish
|
||||
if test -d /tmp
|
||||
cp /etc/motd /tmp/motd
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
If the variable \c MANPATH is defined and not empty, print the contents.
|
||||
(If \c MANPATH is not defined, then it will expand to zero arguments, unless
|
||||
|
@ -81,29 +83,29 @@ quoted.)
|
|||
if test -n "$MANPATH"
|
||||
echo $MANPATH
|
||||
end
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
Parentheses and the \c -o and \c -a operators can be combined to produce
|
||||
Parentheses and the `-o` and `-a` operators can be combined to produce
|
||||
more complicated expressions. In this example, success is printed if there is
|
||||
a \c /foo or \c /bar file as well as a \c /baz or \c /bat file.
|
||||
a `/foo` or `/bar` file as well as a `/baz` or `/bat` file.
|
||||
|
||||
<pre>
|
||||
if test \\( -f /foo -o -f /bar \\) -a \\( -f /baz -o -f /bat \\)
|
||||
\fish
|
||||
if test \( -f /foo -o -f /bar \) -a \( -f /baz -o -f /bat \)
|
||||
echo Success.
|
||||
end.
|
||||
</pre>
|
||||
\endfish
|
||||
|
||||
\subsection test-standards Standards
|
||||
|
||||
\c test implements a subset of the
|
||||
`test` implements a subset of the
|
||||
<a href="http://www.unix.com/man-page/POSIX/1/test/">IEEE Std 1003.1-2008
|
||||
(POSIX.1) standard</a>. The following exceptions apply:
|
||||
- The \c < and \c > operators for comparing strings are not implemented.
|
||||
- The `<` and `>` operators for comparing strings are not implemented.
|
||||
- Because this test is a shell builtin and not a standalone utility, using
|
||||
the -c flag on a special file descriptors like standard input and output
|
||||
may not return the same result when invoked from within a pipe as one
|
||||
would expect when invoking the \c test utility in another shell.
|
||||
|
||||
In cases such as this, one can use \c command \c test to explicitly
|
||||
use the system's standalone \c test rather than this \c builtin \c test.
|
||||
would expect when invoking the `test` utility in another shell.
|
||||
|
||||
In cases such as this, one can use `command` `test` to explicitly
|
||||
use the system's standalone `test` rather than this `builtin` `test`.
|
||||
|
||||
|
|
|
@ -1,43 +1,45 @@
|
|||
\section trap trap - perform an action when the shell receives a signal
|
||||
|
||||
\subsection trap-synopsis Synopsis
|
||||
<tt>trap [OPTIONS] [[ARG] SIGSPEC ... ]</tt>
|
||||
\fish{syn}
|
||||
trap [OPTIONS] [[ARG] SIGSPEC ... ]
|
||||
\endfish
|
||||
|
||||
\subsection trap-description Description
|
||||
|
||||
\c 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>.
|
||||
|
||||
The following parameters are available:
|
||||
|
||||
- \c ARG is the command to be executed on signal delivery.
|
||||
- \c SIGSPEC is the name of the signal to trap.
|
||||
- \c -h or \c --help displays help and exits.
|
||||
- \c -l or \c --list-signals prints a list of signal names.
|
||||
- \c -p or \c --print prints all defined signal handlers.
|
||||
- `ARG` is the command to be executed on signal delivery.
|
||||
- `SIGSPEC` is the name of the signal to trap.
|
||||
- `-h` or `--help` displays help and exits.
|
||||
- `-l` or `--list-signals` prints a list of signal names.
|
||||
- `-p` or `--print` prints all defined signal handlers.
|
||||
|
||||
If \c ARG and \c SIGSPEC are both specified, \c ARG is the command to be
|
||||
executed when the signal specified by \c SIGSPEC is delivered.
|
||||
If `ARG` and `SIGSPEC` are both specified, `ARG` is the command to be
|
||||
executed when the signal specified by `SIGSPEC` is delivered.
|
||||
|
||||
If \c 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 \c ARG is the null string the signal
|
||||
specified by each \c SIGSPEC is ignored by the shell and by the commands
|
||||
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 \c ARG is not present and \c -p has been supplied, then the trap commands
|
||||
associated with each \c SIGSPEC are displayed. If no arguments are
|
||||
supplied or if only \c -p is given, \c trap prints the list of 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.
|
||||
|
||||
Signal names are case insensitive and the \c SIG prefix is optional.
|
||||
Signal names are case insensitive and the `SIG` prefix is optional.
|
||||
|
||||
The return status is 1 if any \c SIGSPEC is invalid; otherwise trap
|
||||
The return status is 1 if any `SIGSPEC` is invalid; otherwise trap
|
||||
returns 0.
|
||||
|
||||
\subsection trap-example Example
|
||||
|
||||
<code>trap "status --print-stack-trace" SIGUSR1</code> prints a stack trace
|
||||
each time the \c SIGUSR1 signal is sent to the shell.
|
||||
`trap "status --print-stack-trace" SIGUSR1` prints a stack trace
|
||||
each time the `SIGUSR1` signal is sent to the shell.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,13 @@
|
|||
\section type type - indicate how a command would be interpreted
|
||||
|
||||
\subsection type-synopsis Synopsis
|
||||
<tt>type [OPTIONS] NAME [NAME ...]</tt>
|
||||
\fish{syn}
|
||||
type [OPTIONS] NAME [NAME ...]
|
||||
\endfish
|
||||
|
||||
\subsection type-description Description
|
||||
|
||||
With no options, \c type indicates how each \c NAME would be interpreted if used as a command name.
|
||||
With no options, `type` indicates how each `NAME` would be interpreted if used as a command name.
|
||||
|
||||
The following options are available:
|
||||
|
||||
|
@ -17,9 +19,9 @@ 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 -q or \c --quiet suppresses all output; this is useful when testing the exit status.
|
||||
|
||||
\c 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.
|
||||
|
||||
\subsection type-example Example
|
||||
|
||||
<tt>type fg</tt> outputs the string 'fg is a shell builtin'.
|
||||
`type fg` outputs the string '`fg is a shell builtin`'.
|
||||
|
|
|
@ -1,46 +1,48 @@
|
|||
\section ulimit ulimit - set or get resource usage limits
|
||||
|
||||
\subsection ulimit-synopsis Synopsis
|
||||
<tt>ulimit [OPTIONS] [LIMIT]</tt>
|
||||
\fish{syn}
|
||||
ulimit [OPTIONS] [LIMIT]
|
||||
\endfish
|
||||
|
||||
\subsection ulimit-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
Use one of the following switches to specify which resource limit to set or report:
|
||||
|
||||
- <code>-c</code> or <code>--core-size</code>: the maximum size of core files created. By setting this limit to zero, core dumps can be disabled.
|
||||
- <code>-d</code> or <code>--data-size</code>: the maximum size of a process' data segment.
|
||||
- <code>-f</code> or <code>--file-size</code>: the maximum size of files created by the shell.
|
||||
- <code>-l</code> or <code>--lock-size</code>: the maximum size that may be locked into memory.
|
||||
- <code>-m</code> or <code>--resident-set-size</code>: the maximum resident set size.
|
||||
- <code>-n</code> or <code>--file-descriptor-count</code>: the maximum number of open file descriptors (most systems do not allow this value to be set).
|
||||
- <code>-s</code> or <code>--stack-size</code>: the maximum stack size.
|
||||
- <code>-t</code> or <code>--cpu-time</code>: the maximum amount of CPU time in seconds.
|
||||
- <code>-u</code> or <code>--process-count</code>: the maximum number of processes available to a single user.
|
||||
- <code>-v</code> or <code>--virtual-memory-size</code> The maximum amount of virtual memory available to the shell.
|
||||
- `-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.
|
||||
- `-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.
|
||||
- `-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).
|
||||
- `-s` or `--stack-size`: the maximum stack size.
|
||||
- `-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.
|
||||
- `-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.
|
||||
|
||||
The value of limit can be a number in the unit specified for
|
||||
the resource or one of the special values <tt>hard</tt>, <tt>soft</tt>, or <tt>unlimited</tt>,
|
||||
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
|
||||
no option is given, then \c -f is assumed. Values are in kilobytes,
|
||||
except for \c -t, which is in seconds and \c -n and \c -u, which are unscaled
|
||||
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.
|
||||
|
||||
\c 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:
|
||||
|
||||
- <code>-H</code> or <code>--hard</code> sets hard resource limit
|
||||
- <code>-S</code> or <code>--soft</code> sets soft resource limit
|
||||
- `-H` or `--hard` sets hard resource limit
|
||||
- `-S` or `--soft` sets soft resource limit
|
||||
|
||||
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
|
||||
|
@ -48,19 +50,19 @@ 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 <tt>ulimit</tt>:
|
||||
The following additional options are also understood by `ulimit`:
|
||||
|
||||
- <code>-a</code> or <code>--all</code> prints all current limits
|
||||
- <code>-h</code> or <code>--help</code> displays help and exits.
|
||||
- `-a` or `--all` prints all current limits
|
||||
- `-h` or `--help` displays help and exits.
|
||||
|
||||
The \c fish implementation of \c ulimit should behave identically to the
|
||||
The `fish` implementation of `ulimit` should behave identically to the
|
||||
implementation in bash, except for these differences:
|
||||
|
||||
- Fish \c ulimit supports GNU-style long options for all switches
|
||||
- Fish \c ulimit does not support the \c -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 \c ulimit does not support getting or setting multiple limits in one command, except reporting all values using the -a switch
|
||||
- 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 getting or setting multiple limits in one command, except reporting all values using the -a switch
|
||||
|
||||
\subsection ulimit-example Example
|
||||
|
||||
<tt>ulimit -Hs 64</tt> sets the hard stack size limit to 64 kB.
|
||||
`ulimit -Hs 64` sets the hard stack size limit to 64 kB.
|
||||
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
\section umask umask - set or get the file creation mode mask
|
||||
|
||||
\subsection umask-synopsis Synopsis
|
||||
<code>umask [OPTIONS] [MASK]</code>
|
||||
\fish{syn}
|
||||
umask [OPTIONS] [MASK]
|
||||
\endfish
|
||||
|
||||
\subsection umask-description Description
|
||||
|
||||
\c 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.
|
||||
|
||||
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.
|
||||
|
||||
Access rights are explained in the manual page for the \c 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
|
||||
an octal number.
|
||||
|
||||
- <code>-h</code> or <code>--help</code> prints this message.
|
||||
- <code>-S</code> or <code>--symbolic</code> prints the umask in symbolic form instead of octal form.
|
||||
- <code>-p</code> or <code>--as-command</code> outputs the umask in a form that may be reused as input
|
||||
- `-h` or `--help` prints this message.
|
||||
- `-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
|
||||
|
||||
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
|
||||
|
@ -30,21 +32,21 @@ 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
|
||||
be one of \c u, \c g, \c o or \c a, where \c u specifies the user who
|
||||
owns the file, \c g specifies the group owner of the file, \c o
|
||||
specific other users rights and \c a specifies all three should be
|
||||
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
|
||||
=, \c + or \c -, where \c = specifies that the rights should be set to
|
||||
the new value, \c + specifies that the specified right should be added
|
||||
to those previously specified and \c - specifies that the specified
|
||||
=, `+` 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 \c r, \c w and \c x, representing
|
||||
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 \c a
|
||||
and \c =, respectively. As an example, <code>r,u+w</code> means all
|
||||
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.
|
||||
|
||||
|
@ -52,7 +54,7 @@ Note that symbolic masks currently do not work as intended.
|
|||
|
||||
\subsection umask-example Example
|
||||
|
||||
<code>umask 177</code> or <code>umask u=rw</code> 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.
|
||||
|
||||
|
|
261
doc_src/user_doc.css.in
Normal file
261
doc_src/user_doc.css.in
Normal file
|
@ -0,0 +1,261 @@
|
|||
* {
|
||||
margin: 0;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html { font-size: 62.5%; }
|
||||
html, body {
|
||||
min-height: 100%;
|
||||
background: #fff;
|
||||
color: #111;
|
||||
}
|
||||
body {
|
||||
text-rendering: optimizeLegibility;
|
||||
overflow: hidden;
|
||||
}
|
||||
.logo {
|
||||
position: absolute;
|
||||
width: 200px;
|
||||
height: 135px;
|
||||
background-image: url(ascii_fish.png);
|
||||
}
|
||||
/*Top site index*/
|
||||
.qindex {
|
||||
font: 500 1.4rem/3.6rem "DejaVuSansCondensed", Roboto, Verdana, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
border: none;
|
||||
color: white;
|
||||
background-color: #1f2d53;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 3.6rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* Don't show the header */
|
||||
.header { display: none; }
|
||||
/*Substructure*/
|
||||
.contents {
|
||||
margin: 0;
|
||||
min-width: 570px;
|
||||
}
|
||||
.fish_left_bar, .fish_right_bar, .fish_only_bar {
|
||||
position: absolute;
|
||||
top: 3.6rem;
|
||||
bottom: 0;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch; /* necessary for momentum scrolling */
|
||||
font: 400 1.4rem/2.3rem "DejaVuSans", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.fish_left_bar {
|
||||
width: 250px;
|
||||
color: white;
|
||||
font-family: "DejaVuSansCondensed", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
background-color: #1f2d53;
|
||||
}
|
||||
.fish_left_little { width: 200px; }
|
||||
.fish_left_big { width: 380px; }
|
||||
.fish_right_bar {
|
||||
margin-left: 250px;
|
||||
margin-right: 0;
|
||||
padding: 0 3rem;
|
||||
-moz-box-shadow: -6px 0 6px 4px black;
|
||||
-webkit-box-shadow: -6px 0 6px 4px black;
|
||||
box-shadow: -0.6rem 0 0.6rem 0.4rem rgba(0,0,0,0.4);
|
||||
}
|
||||
.fish_right_little { margin-left: 380px; }
|
||||
.fish_right_big { margin-left: 200px; }
|
||||
.fish_only_bar {
|
||||
width: 100%;
|
||||
}
|
||||
hr {
|
||||
height: 0;
|
||||
border: none;
|
||||
border-top: 1px solid #AAA;
|
||||
}
|
||||
/*Ineraction*/
|
||||
a { color: #3d5cb3; }
|
||||
.qindex a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
.qindex a:hover { text-decoration: underline; }
|
||||
.fish_left_bar a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
.fish_left_bar a:visited { color: inherit; }
|
||||
.fish_left_bar a:hover { color: #88aaff; }
|
||||
.fish_right_bar a { text-decoration: none; }
|
||||
.fish_right_bar a:hover { text-decoration: underline; }
|
||||
/* Adjust lists */
|
||||
.fish_left_bar ul {
|
||||
padding-left: 2rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.fish_right_bar ul {
|
||||
list-style-type: circle;
|
||||
padding-left: 2.4rem;
|
||||
margin: 1.4rem 0;
|
||||
}
|
||||
.fish_right_bar ul li {
|
||||
margin-bottom: 0.6rem;
|
||||
}
|
||||
.fish_right_bar p > code {
|
||||
display: inline-block;
|
||||
}
|
||||
/* Typography */
|
||||
p { margin: 1rem 0; }
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #1f2d53;
|
||||
font-family: Roboto, "DejaVuSansCondensed-Bold", "DejaVuSans-Bold", Verdana, sans-serif;
|
||||
}
|
||||
h1 {
|
||||
margin: 2rem 0 1.4rem 0;
|
||||
font-weight: 700;
|
||||
font-size: 2rem;
|
||||
}
|
||||
h2 {
|
||||
margin: 1.6rem 0 1rem 0;
|
||||
font-weight: 600;
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
h3 {
|
||||
margin: 1rem 0 0.4rem 0;
|
||||
font-weight: 500;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
.interior_title {
|
||||
font-size: 2rem;
|
||||
color: #414141;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #AAA;
|
||||
}
|
||||
/*Special Formmating for Code and keys*/
|
||||
.key span {
|
||||
display:none;
|
||||
}
|
||||
.key em {
|
||||
margin-right: 2px;
|
||||
font-style: normal;
|
||||
}
|
||||
.key em, .key b {
|
||||
padding: 0 4px;
|
||||
background-color: #fafafa;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 3px;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
tt, code, pre, .fish {
|
||||
font-family: "DejaVu Sans Mono", Menlo, Monaco, "Source Code Pro", "Ubuntu Mono", "Consolas", "Lucida Console", monospace, fixed;
|
||||
font-weight: 500;
|
||||
text-shadow: 0 0 0 rgba(0,0,0,1); /* Stronger anti-aliasing */
|
||||
}
|
||||
tt {
|
||||
color: red; /*REMOVE THIS*/
|
||||
}
|
||||
code, pre, .line {
|
||||
white-space: -moz-pre-wrap;
|
||||
white-space: -pre-wrap;
|
||||
white-space: -o-pre-wrap;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
h1 > code, h2 > code, h3 > code {
|
||||
font-family: "DejaVu Sans Mono", Menlo, "Source Code Pro", "Consolas", "Lucida Console", Roboto, Verdana, sans-serif;
|
||||
font-weight: 700;
|
||||
}
|
||||
.fish {
|
||||
margin: 1rem;
|
||||
padding: 0.4rem 1rem;
|
||||
line-height: 1.9rem;
|
||||
background-color: #fafafa;
|
||||
border: 1px solid #f0f0f0;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
|
||||
.comment { color: #777; }
|
||||
.command { color: #0A0; }
|
||||
.function { color: #0A0; }
|
||||
.binary { color: #060; }
|
||||
.argument { color: #906; }
|
||||
.variable { color: #339; }
|
||||
.redirect { color: #F00; }
|
||||
.operator { color: #990; }
|
||||
.file { color: #c97922; }
|
||||
.path { color: #c97922; }
|
||||
.string { color: #770; }
|
||||
.prompt { color: #03C; }
|
||||
.suggest { color: cyan ; }
|
||||
.error { color: red; font-weight: bold; }
|
||||
.cursor { border-bottom: 2px solid green; }
|
||||
|
||||
|
||||
/*.keyword, .keywordflow { color: #050; }*/
|
||||
/*.stringliteral, .charliteral { color: #226; }*/
|
||||
/*.preprocessor, .comment { color: #555; text-shadow: none; }*/
|
||||
|
||||
.cli-dark {
|
||||
background-color: #111;
|
||||
color: #ddd;
|
||||
padding: 0.4rem 2rem;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
/*
|
||||
.cli .command {
|
||||
color: #0E0;
|
||||
font-weight: bold;
|
||||
}
|
||||
.cli .function {
|
||||
color: #0C0;
|
||||
}*/
|
||||
/*Menus*/
|
||||
.menu { margin: 1.4rem 0; line-height: 2.2rem; }
|
||||
.menu ul { list-style-type: none; }
|
||||
.menu > ul li { position: relative; }
|
||||
.menu > ul li:before {
|
||||
content: "›";
|
||||
color: #88aaff;
|
||||
font-size: 1.6rem;
|
||||
position: absolute;
|
||||
left: -1rem;
|
||||
top: -1px;
|
||||
}
|
||||
/*Page overrides*/
|
||||
/*Documentation*/
|
||||
.docs_menu { line-height: 2rem }
|
||||
.docs_menu > ul > li { position: static; }
|
||||
.docs_menu > ul ul { margin: 0.6rem 0; }
|
||||
.docs_menu > ul ul > li { margin-bottom: 0.2rem; }
|
||||
/*Tutorial*/
|
||||
|
||||
/*Design*/
|
||||
.design {
|
||||
max-width: 780px;
|
||||
margin: 0 auto;
|
||||
padding: 0 4rem;
|
||||
}
|
||||
/*Commands*/
|
||||
.commands_menu { line-height: 2rem }
|
||||
/*FAQ*/
|
||||
.faq_menu { line-height: 2rem }
|
||||
.faq_menu > ul li { margin-bottom: 0.6rem; }
|
||||
/*Licenses*/
|
||||
.license {
|
||||
max-width: 780px;
|
||||
margin: 0 auto;
|
||||
padding: 0 4rem;
|
||||
}
|
||||
.license li { margin: 1rem 0; }
|
||||
.license ul li:first-child {
|
||||
list-style-type: none;
|
||||
position: relative;
|
||||
}
|
||||
.license ul li:first-child:before {
|
||||
content: "0.";
|
||||
position: absolute;
|
||||
left: -2rem;
|
||||
}
|
||||
|
||||
|
2
doc_src/user_doc.footer.html
Normal file
2
doc_src/user_doc.footer.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
</body>
|
||||
</html>
|
24
doc_src/user_doc.header.html
Normal file
24
doc_src/user_doc.header.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||
<title>$projectname: $title</title>
|
||||
$extrastylesheet
|
||||
</head>
|
||||
<body>
|
||||
<div id="top" class="qindex"><!-- do not close this div here, it is closed by doxygen! -->
|
||||
<a href="http://fishshell.com/"><code>fish</code> shell</a>
|
||||
|
|
||||
<a href="index.html">Documentation</a>
|
||||
|
|
||||
<a href="tutorial.html">Tutorial</a>
|
||||
|
|
||||
<a href="design.html">Design</a>
|
||||
|
|
||||
<a href="commands.html">Commands</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="license.html">License</a>
|
|
@ -1,14 +1,16 @@
|
|||
\section vared vared - interactively edit the value of an environment variable
|
||||
|
||||
\subsection vared-synopsis Synopsis
|
||||
<tt>vared VARIABLE_NAME</tt>
|
||||
\fish{syn}
|
||||
vared VARIABLE_NAME
|
||||
\endfish
|
||||
|
||||
\subsection vared-description Description
|
||||
|
||||
\c vared is used to interactively edit the value of an environment
|
||||
variable. Array variables as a whole can not be edited using \c vared,
|
||||
`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.
|
||||
|
||||
\subsection vared-example Example
|
||||
|
||||
<code>vared PATH[3]</code> edits the third element of the PATH array
|
||||
`vared PATH[3]` edits the third element of the PATH array
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
\section while while - perform a command multiple times
|
||||
|
||||
\subsection while-synopsis Synopsis
|
||||
<tt>while CONDITION; COMMANDS...; end</tt>
|
||||
\fish{syn}
|
||||
while CONDITION; COMMANDS...; end
|
||||
\endfish
|
||||
|
||||
\subsection while-description Description
|
||||
<tt>while</tt> repeatedly executes <tt>CONDITION</tt>, and if the exit status
|
||||
is 0, then executes <tt>COMMANDS</tt>.
|
||||
`while` repeatedly executes `CONDITION`, and if the exit status
|
||||
is 0, then executes `COMMANDS`.
|
||||
|
||||
If the exit status of \c CONDITION is non-zero on the first iteration,
|
||||
\c 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"><tt>begin; ...; end</tt></a> for complex conditions; more
|
||||
complex control can be achieved with <tt>while true</tt> containing 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
|
||||
|
||||
<tt>while test -f foo.txt; echo file exists; sleep 10; end</tt>
|
||||
`while test -f foo.txt; echo file exists; sleep 10; end`
|
||||
outputs 'file exists' at 10 second intervals as long as
|
||||
the file foo.txt exists.
|
||||
|
|
|
@ -1,166 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>fish user documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<style type='text/css'>
|
||||
|
||||
/* fish documentation CSS overrides */
|
||||
|
||||
/* No scrollbar on the body. Our columns are independently scrollable */
|
||||
body
|
||||
{
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fish_left_bar, .fish_right_bar, .fish_only_bar
|
||||
{
|
||||
position: absolute;
|
||||
top: 36px;
|
||||
bottom: 0;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch; /* necessary for momentum scrolling */
|
||||
}
|
||||
|
||||
.fish_left_bar
|
||||
{
|
||||
width: 250px;
|
||||
color: white;
|
||||
}
|
||||
.fish_left_bar a { color: white; }
|
||||
.fish_left_bar a:visited { color: inherit; }
|
||||
.fish_right_bar
|
||||
{
|
||||
margin-left: 250px;
|
||||
margin-right: 0px;
|
||||
padding: 0 0 0 20px; /* 20 px on left */
|
||||
background-color: white;
|
||||
-moz-box-shadow: -5px 0px 5px -2px black;
|
||||
-webkit-box-shadow: -5px 0px 5px -2px black;
|
||||
box-shadow: -5px 0px 5px -2px black;
|
||||
}
|
||||
|
||||
.fish_right_bar p
|
||||
{
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.fish_left_big { width: 380px; }
|
||||
.fish_right_little { margin-left: 380px; }
|
||||
|
||||
.fish_left_medium { width: 280; }
|
||||
.fish_right_medium { margin-left: 280; }
|
||||
|
||||
.fish_left_little { width: 200px; }
|
||||
.fish_right_big { margin-left: 200px; }
|
||||
|
||||
|
||||
.fish_only_bar
|
||||
{
|
||||
padding: 0px 20px;
|
||||
}
|
||||
|
||||
h1, h2, h3 { color: #1E335E; }
|
||||
|
||||
h1 { font-size: 150%; }
|
||||
h2 { font-size: 115%; }
|
||||
h3 { font-size: 105%; }
|
||||
|
||||
/* Don't show the header */
|
||||
div.header { display: none; }
|
||||
|
||||
h1.interior_title, h1.interior_title_borderless {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
h1.interior_title {
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #AAA;
|
||||
}
|
||||
|
||||
div.contents { margin: 0px; }
|
||||
|
||||
div.qindex
|
||||
{
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
background-image: none;
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
.fish_left_bar, div.header, div.qindex
|
||||
{
|
||||
background-color: #1E335E;
|
||||
}
|
||||
|
||||
div.qindex
|
||||
{
|
||||
border: none;
|
||||
padding: 3px 0px;
|
||||
|
||||
/* Ensure the bottom border is visible over the left column */
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
div.qindex a
|
||||
{
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Hide the doxygen logo */
|
||||
.footer { display: none; }
|
||||
|
||||
/* Don't let pre elements create a minimum width on the right bar */
|
||||
.fish_right_bar pre { white-space:pre-wrap; }
|
||||
|
||||
/* Adjust list */
|
||||
.fish_left_bar ul {
|
||||
padding-left: 27px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.fish_left_bar ul li { margin-bottom: 5px; }
|
||||
|
||||
/* Tighter lists for the little (command) bar */
|
||||
.fish_left_little ul li { margin-bottom: 0; }
|
||||
|
||||
/* Adjust sublists */
|
||||
.fish_left_bar ul ul { padding-left: 17px; }
|
||||
.fish_left_bar ul ul li { margin-bottom: 0; }
|
||||
|
||||
/* Link hover */
|
||||
.fish_left_bar a:hover {
|
||||
text-decoration: none;
|
||||
background-color: inherit;
|
||||
color: #99BBFF;
|
||||
}
|
||||
|
||||
/* Horizontal bar */
|
||||
hr {
|
||||
height: 1px;
|
||||
border: 0;
|
||||
background-color: #AAA;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="qindex">
|
||||
|
||||
<a class="qindex" href="http://fishshell.com/"><tt>fish</tt> shell</a>
|
||||
|
|
||||
<a class="qindex" href="index.html">Documentation</a>
|
||||
|
|
||||
<a class="qindex" href="tutorial.html">Tutorial</a>
|
||||
|
|
||||
<a class="qindex" href="design.html">Design</a>
|
||||
|
|
||||
<a class="qindex" href="commands.html">Commands</a>
|
||||
|
|
||||
<a class="qindex" href="faq.html">FAQ</a>
|
||||
|
|
||||
<a class="qindex" href="license.html">License</a>
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in a new issue