Add subdirectories

darcs-hash:20050920133155-ac50b-9a14c6c664dd03afbe8e15e7c7998fcfb5c3c750.gz
This commit is contained in:
axel
2005-09-20 23:31:55 +10:00
parent 149594f974
commit 7ddecde543
188 changed files with 8114 additions and 0 deletions

1161
doc_src/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

23
doc_src/and.txt Normal file
View File

@@ -0,0 +1,23 @@
\section and and - Conditionally execute a command
\subsection and-synopsis Synopsis
<tt>and COMMAND1; COMMAND2</tt>
\subsection and-description Description
The \c and builtin is used to execute one command, and if it returns
zero status, also execute a second command.
\subsection and-example Example
The following code runs the \c make command to build a program, and if it suceeds, it runs <tt>make install</tt>, which installs the program.
<pre>
and make; make install
</pre>
\c or and \c and can be nested, as in this example, that attempts to build and install a program, and removed the files created by the build process on failiure
<pre>
or and make; make install; make clean
</pre>

30
doc_src/begin.txt Normal file
View File

@@ -0,0 +1,30 @@
\section begin begin - Start a new block of code
\subsection begin-synopsis Synopsis
<tt>begin; [COMMAND;...] end </tt>
\subsection begin-description Description
The \c begin builtin is used to create a new block of code. The block
is unconditionally erxecuted. Begin is equivalent to <tt>if
true</tt>. The begin command is used to group any number of commands
into a block. The reason for this is usually either to introduce a new
variable scope or to redirect the input ot output of this set of
commands as a group.
\subsection begin-example Example
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>
begin
set -x PIRATE Yarrr
...
end
# This will not output anything, since PIRATE went out of scope at the end of
# the block and was killed
echo $PIRATE
</pre>

16
doc_src/bg.txt Normal file
View File

@@ -0,0 +1,16 @@
\section bg bg - send to background
\subsection bg-synopsis Synopsis
<tt>bg [PID...]</tt>
\subsection bg-description Description
Sends the specified jobs to the background. 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 group ids are put in the background.
The PID of the desired process is usually found by using process globbing.
\subsection bg-example Example
<tt>bg \%0</tt> will put the job with job id 0 in the background.

16
doc_src/bind.txt Normal file
View File

@@ -0,0 +1,16 @@
\section bind bind - Handle key bindings.
\subsection bind-synopsis Synopsis
<tt>bind [OPTIONS] [BINDINGS...] </tt>
The <tt>bind</tt> builtin causes fish to add the readline style bindings specified by <tt>BINDINGS</tt> to the list of key bindings. For more information on specifying keyboard bindings, use <tt>man readline</tt> to access the readline documentation.
\subsection bind-description Description
- <tt>-M MODE</tt> or <tt>--set-mode=MODE</tt> sets the current input mode to MODE.
\subsection bind-example Example
<tt>bind -M vi</tt> changes to the vi input mode
<tt>bind '"\\M-j": jobs'</tt> Binds the jobs command to the Alt-j keyboard shortcut

21
doc_src/break.txt Normal file
View File

@@ -0,0 +1,21 @@
\section break break - stop the innermost currently evaluated loop
\subsection break-synopsis Synopsis
<tt>LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end</tt>
\subsection break-description Description
The \c break builtin is used to halt 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.
\subsection break-example Example
The following code searches all .c files for smurfs, and halts at the first occurance.
<p>
<tt>for i in *.c;
<br>&nbsp;&nbsp;&nbsp;&nbsp;if grep smurf $i;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo Smurfs are present in $i;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
<br>&nbsp;&nbsp;&nbsp;&nbsp;end;
<br>end;
</tt>
</p>

17
doc_src/builtin.txt Normal file
View File

@@ -0,0 +1,17 @@
\section builtin builtin - run a builtin command
\subsection builtin-synopsis Synopsis
<tt>builtin BUILTINNAME [OPTIONS...]</tt>
\subsection builtin-description Description
- <tt>-n</tt> or <tt>--names</tt> List the names of all defined builtins
Prefixing a command with the word 'builtin' forces fish to ignore any aliases with the same name.
\subsection builtin-example Example
<tt>builtin jobs</tt>
causes fish to execute the jobs builtin, even if a function named jobs exists.

35
doc_src/case.txt Normal file
View File

@@ -0,0 +1,35 @@
\section case case - conditionally execute a block of commands
\subsection case-synopsis Synopsis
<tt>switch VALUE; [case [WILDCARD...]; [COMMANDS...];...] end</tt>
\subsection case-description Description
The \c switch statement is used to perform one of several blocks of
commands depending on whether a specified value equals one of several
wildcarded values. The \c case statement is used together with the \c
switch statement in order to determine which block should be
performed.
\subsection case-example Example
If the variable \$animal contains the name of an animal, the following
code would attempt to classify it:
<p>
<pre>
switch $animal
case cat
echo evil
case wolf dog human moose dolphin whale
echo mammal
case duck goose albatros
echo bird
case shark trout stingray
echo fish
end
</pre>
</p>
<p>
If the above code was run with \$animal set to \c whale, the output would be \c mammal.
</p>

12
doc_src/cd.txt Normal file
View File

@@ -0,0 +1,12 @@
\section cd cd - change directory
\subsection cd-synopsis Synopsis
<tt>cd [DIRECTORY]</tt>
\subsection cd-description Description
Changes the current directory. If <tt>DIRECTORY</tt> is supplied it
will become the new directory. If \c DIRECTORY is a relative path, the
CDPATH environment variable will be separated using the : as
separator, and the resulting list will be searched for a suitable new
current directory. If CDPATH is not set, it is assumed to be '.'. If
\c DIRECTORY is not specified, \$HOME will be the new directory.

14
doc_src/command.txt Normal file
View File

@@ -0,0 +1,14 @@
\section command command - run a program
\subsection command-synopsis Synopsis
<tt>command COMMANDNAME [OPTIONS...]</tt>
\subsection command-description Description
prefixing a command with the word 'command' forces fish to ignore any aliases or builtins with the same name.
\subsection command-example Example
<tt>command ls</tt>
causes fish to execute the ls program, even if there exists a 'ls' alias.

51
doc_src/commandline.txt Normal file
View File

@@ -0,0 +1,51 @@
\section commandline commandline - Set or get the current commandline buffer
\subsection commandline-synopsis Synopsis
<tt>commandline [OPTIONS] [CMD]</tt>
\subsection commandline-description Description
- \c CMD is the new value of the commandline. If unspecified, the
current value of the commandline is written to standard output.
The following switches change the way \c commandline updates the
commandline
- \c -a or \c --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
the specified string at the current cursor position
- \c -r or \c --replace remove the current commandline and replace it
with the specified string (default)
The following switches 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.
The following switch changes the way \c commandline prints the current
commandline
- \c -c or \c --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
Other switches
- \c -f or \c --function inject readline functions into the
reader. This option can not 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 keypresses are read.
\subsection commandline-example Example
<tt>commandline -j $history[3]</tt>
replaces the job under the cursor with the third item from the
commandline history.

67
doc_src/complete.txt Normal file
View File

@@ -0,0 +1,67 @@
\section complete complete - edit command specific tab-completions.
\subsection complete-synopsis Synopsis
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION] </tt>
\subsection complete-description Description
- <tt>COMMAND</tt> is the name of the command for which to add a completion
- <tt>SHORT_OPTION</tt> is a one character option for the command
- <tt>LONG_OPTION</tt> is a multi character option for the command
- <tt>OPTION_ARGUMENTS</tt> is parameter containing a space-separated list of possible option-arguments, which may contain subshells
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
- <tt>-n</tt> or <tt>--condition</tt> specides a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
- <tt>-o</tt> or <tt>--old-option</tt> implies that the command uses old long style options with only one dash
- <tt>-p</tt> or <tt>--path</tt> implies that the string COMMAND is the full path of the command
- <tt>-r</tt> or <tt>--require-parameter</tt> specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option
- <tt>-u</tt> or <tt>--unauthorative</tt> implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors
- <tt>-x</tt> or <tt>--exclusive</tt> implies both <tt>-r</tt> and <tt>-f</tt>
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
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 preceeded by a single hyphen and may ge 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 are more than one character long, are preceeded 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 are more than one character long, are preceeded 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 abbrevated so long as the abbrevation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
\c complete only allows one of old style long options and GNU style
long options to be used on a specific command, but short options can
always be specified.
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
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 <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>.
The \c 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>.
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.
This can be written as:
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d 'Dont check dependencies'</tt>
where \c __fish_contains_opt is a function that checks the commandline buffer for the presense of a specified set of options.

20
doc_src/continue.txt Normal file
View File

@@ -0,0 +1,20 @@
\section continue continue - skip the rest of the current lap of the innermost currently evaluated loop
\subsection continue-synopsis Synopsis
<tt>LOOP_CONSTRUCT; [COMMANDS...] continue; [COMMANDS...] end</tt>
\subsection continue-description Description
The \c continue builtin is used to skip the current lap of the innermost 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.
\subsection continue-example Example
The following code removes all tmp files without smurfs.
<p>
<tt>for i in *.tmp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;if grep smurf $i;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;
<br>&nbsp;&nbsp;&nbsp;&nbsp;end;
<br>&nbsp;&nbsp;&nbsp;&nbsp;rm $i;
<br>end;
</tt>
</p>

33
doc_src/count.txt Normal file
View File

@@ -0,0 +1,33 @@
\section count count - Count the number of elements of an array
\subsection count-synopsis Synopsis
<tt>count $VARIABLE</tt>
\subsection count-description Description
<tt>count</tt> returns the number of arguments that where passed to
it. This is usually used to find out how many elements an environment
variable array contains, but this is not the only potential usage for
the count command.
The count command does not accept any options, not even '-h'. This way
the user does not have to worry about an array containing elements
such as dashes. \c fish performs a special check when invoking the
count program, and if the user uses a help option, this help page is
displayed, but if a help option is contained inside of a variable or
is the result of expantion, it will be passed on to the count program.
\subsection count-example Example
<pre>
count $PATH
</pre>
returns the number of directories in the users PATH variable.
<pre>
count *.txt
</pre>
returns the number of files in the current working directory ending with the suffix '.txt'.

8
doc_src/dirh.txt Normal file
View File

@@ -0,0 +1,8 @@
\section dirh dirh
\subsection dirh-synopsis Synopsis
<tt>dirh</tt>
\subsection dirh-description Description
<tt>dirh</tt> prints the current directory history. The current position in the
history is highlighted using <tt>$fish_color_history_current</tt>.

7
doc_src/dirs.txt Normal file
View File

@@ -0,0 +1,7 @@
\section dirs dirs
\subsection dirs-synopsis Synopsis
<tt>dirs</tt>
\subsection dirs-description Description
<tt>dirs</tt> prints the current directory stack.

1832
doc_src/doc.hdr Normal file

File diff suppressed because it is too large Load Diff

17
doc_src/else.txt Normal file
View File

@@ -0,0 +1,17 @@
\section else else - execute command if a condition is not met.
\subsection else-synopsis Synopsis
<tt>if CONDITION; COMMAND_TRUE [else; COMMAND_FALSE] end;</tt>
\subsection else-description Description
<tt>if</tt> will execute the command CONDITION. If the commands exit
status is zero, the command COMMAND_TRUE will execute. If it is
not zero and COMMAND_FALSE is specified, COMMAND_FALSE will be
executed.
\subsection else-example Example
The command <tt>if test -f foo.txt; echo foo.txt exists; else; echo foo.txt does not exist; end</tt>
will print <tt>foo.txt exists</tt> if the file foo.txt
exists and is a regular file, otherwise it will print
<tt>foo.txt does not exist</tt>.

13
doc_src/end.txt Normal file
View File

@@ -0,0 +1,13 @@
\section end end - end a block of commands.
\subsection end-synopsis Synopsis
<pre>for VARNAME in [VALUES...]; COMMANDS; end
if CONDITION; COMMAND_TRUE [else; COMMAND_FALSE] end
while CONDITION; COMMANDS; end
switch VALUE; [case [WILDCARD...]; [COMMANDS...];...] end
</pre>
\subsection end-description Description
<tt>end</tt> ends a block of commands. For more information, read the
documentation for the block constructs, such as \c if, \c for and \
while.

16
doc_src/eval.txt Normal file
View File

@@ -0,0 +1,16 @@
\section eval eval - eval the specified commands
\subsection eval-synopsis Synopsis
<tt>eval [COMMANDS...]</tt>
\subsection eval-description Description
The <tt>eval</tt> builtin causes fish to evaluate 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
<pre>
set cmd ls
eval $cmd
</pre>
will call the ls command.

16
doc_src/exec.txt Normal file
View File

@@ -0,0 +1,16 @@
\section exec exec - Execute command in current process
\subsection exec-synopsis Synopsis
<tt>exec COMMAND [OPTIONS...]</tt>
\subsection exec-description Description
The \c exec builtin is used to replace the currently running shells
process image with a new command. On sucessfull completion, exec never
returns. exec can not be used inside a pipeline.
\subsection exec-example Example
<tt>exec emacs</tt> starts up the emacs text editor. When emacs exits,
the session will terminate.

14
doc_src/exit.txt Normal file
View File

@@ -0,0 +1,14 @@
\section exit exit - exit the shell.
\subsection exit-synopsis Synopsis
<tt>exit [STATUS]</tt>
\subsection exit-description Description
The <tt>exit</tt> builtin causes fish to exit. If <tt>STATUS</tt> is
supplied, it will be converted to an integer and used as the exit
code. Otherwise the exit code will be 0.
If exit is called while sourcing a file (using the <a
href="#source">.</a> builtin) the rest of the file will be skipped,
but the shell will not exit.

14
doc_src/fg.txt Normal file
View File

@@ -0,0 +1,14 @@
\section fg fg - send job to foreground
\subsection fg-synopsis Synopsis
<tt>fg [PID]</tt>
\subsection fg-description Description
Sends the specified job to the foreground. 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 process globbing.
\subsection fg-example Example
<tt>fg \%0</tt> will put the job with job id 0 in the foreground.

27
doc_src/fish.1.in Normal file
View File

@@ -0,0 +1,27 @@
.TH fish 1 "February 25, 2005" "version @PACKAGE_VERSION@" "USER COMMANDS"
.SH NAME
fish - friendly interactive shell
.SH SYNOPSIS
.B fish
[\-h] [\-v] [\-c command] [FILE [ARGUMENTS...]]
.SH DESCRIPTION
A shell written mainly with interactive use in mind. The complete fish manuals are written in HTML format. You can find them by using the
.I
help
command from inside the fish shell.
.SH OPTIONS
.TP
\-h
display help and exit
.TP
\-c
Evaluate the specified commands instead of reading from the commandline
.TP
\-i
Specify that fish is to run in interactive mode
.TP
\-v
display version and exit
.SH AUTHOR
Axel Liljencrantz ( @PACKAGE_BUGREPORT@ )

23
doc_src/for.txt Normal file
View File

@@ -0,0 +1,23 @@
\section for for - perform a set of commands multiple times.
\subsection for-synopsis Synopsis
<tt>for VARNAME in [VALUES...]; [COMMANDS...]; end</tt>
\subsection for-description Description
<tt>for</tt> is a loop construct. It will perform the commands specified
by <tt>COMMANDS</tt> multiple times. Each time the environment variable
specified by <tt>VARNAME</tt> is assigned a new value from <tt>VALUES</tt>.
\subsection for-example Example
The command
<tt>for i in foo bar baz; echo $i; end</tt>
would output:
<pre>foo
bar
baz</pre>

48
doc_src/function.txt Normal file
View File

@@ -0,0 +1,48 @@
\section function function - create a function
\subsection function-synopsis Synopsis
<tt>function NAME; BODY; end </tt>
\subsection function-description Description
This builtin command is used to create a new function. A Function is a
list of commands that will be executed when the name of the function
is entered. The function
<pre>
function hi
echo hello
end
</pre>
will write <tt>hello</tt> whenever the user enters \c hi.
If the user enters any additional arguments after the function, they
are inserted into the environment variable <a href="index.html#variables-arrays">array</a> argv.
\subsection function-example Example
<pre>function ll
ls -l $argv
</pre>
will run the \c ls command, using the \c -l option, while passing on any additional files and switches to \c ls.
<pre>
function mkdir -d "Create a directory and set CWD"
mkdir $argv
if test $status = 0
switch $argv[(count $argv)]
case '-*'
case '*'
cd $argv[(count $argv)]
return
end
end
end
</pre>
will run the mkdir command, and if it is succesfull, change the
current working directory to the one just created.

17
doc_src/functions.txt Normal file
View File

@@ -0,0 +1,17 @@
\section functions functions - print or erase functions
\subsection function-synopsis Synopsis
<tt>functions [-e] FUNCTIONS...</tt>
\subsection functions-description Description
This builtin command is used to print or erase functions.
- <tt>-e</tt> or <tt>--erase</tt> causes the specified functions to be erased.
- <tt>-n</tt> or <tt>--names</tt> List only the names of all defined functions
If \c functions is called with no arguments, the names and definition
of all functions are printed, otherwise, the specified function
definitions will be printed.

16
doc_src/help.txt Normal file
View File

@@ -0,0 +1,16 @@
\section help help - Display fish documantation
\subsection help-synopsis Synopsis
<tt>help [SECTION]</tt>
\subsection help-description Description
The \c help command is used to display a section of the fish help documentation.
If the BROWSER environment variable is set, it will be used to display
the documentation, otherwise fish will search for a suitable browser.
\subsection help-example Example
<tt>help fg</tt> shows the documentation for the \c fg builtin.

23
doc_src/if.txt Normal file
View File

@@ -0,0 +1,23 @@
\section if if - Conditionally execute a command
\subsection if-synopsis Synopsis
<tt>if CONDITION; COMMAND_TRUE [else; COMMAND_FALSE] end;</tt>
\subsection if-description Description
<tt>if</tt> will execute the command CONDITION. If the commands exit
status is zero, the command COMMAND_TRUE will execute. If it is
not zero and COMMAND_FALSE is specified, COMMAND_FALSE will be
executed.
\subsection if-example Example
<pre>
if test -f foo.txt
echo foo.txt exists
else
echo foo.txt does not exist
end
</pre>
will print <tt>foo.txt exists</tt> if the file foo.txt
exists and is a regular file, otherwise it will print
<tt>foo.txt does not exist</tt>.

13
doc_src/jobs.txt Normal file
View File

@@ -0,0 +1,13 @@
\section jobs jobs - print currently running jobs
\subsection jobs-synopsis
<tt>jobs</tt>
\subsection jobs-description Description
The <tt>jobs</tt> builtin causes fish to print a list of the currently
running jobs and their status.
On systems that supports this feature, jobs will also print the CPU
usage of each job since the last command was executed. The CPU usage
is expressed as a percentage of full CPU activity. Note that on
multiprocessor systems, the total activity may be more than 100\%.

19
doc_src/mimedb.txt Normal file
View File

@@ -0,0 +1,19 @@
\section mimedb mimedb - Lookup file information via the mime database
\subsection mimedb-synopsis Synopsis
<tt>mimedb [OPTIONS] FILES...</tt>
\subsection mimedb-description Description
- \c FILES is a list of files to analyse
- \c -t, \c --input-file-data the specified files type should be determined both by their filename and by their contents (Default)
- \c -f, \c --input-filename the specified files type should be determined by their filename
- \c -i, \c --input-mime the arguments are not files but mimetypes
- \c -m, \c --output-mime the output will be the mimetype of each file (Default)
- \c -f, \c --output-description the output will be the description of each mimetype
- \c -a, \c --output-action the output will be the default action of each mimetype
- \c -l, \c --launch launch the default action for the specified file(s)
- \c -h, \c --help Display a help message and exit
- \c -v, \c --version Display version number and exit

9
doc_src/nextd.txt Normal file
View File

@@ -0,0 +1,9 @@
\section nextd nextd
\subsection nextd-synopsis Synopsis
<tt>nextd [-l] [pos]</tt>
\subsection nextd-description Description
<tt>nextd</tt> moves forwards <tt>pos</tt> positions in the history of visited directories;
if the end of the history has been hit, a warning is printed. If the <tt>-l></tt> flag is
specified, the current history is also displayed.

21
doc_src/not.txt Normal file
View File

@@ -0,0 +1,21 @@
\section not not - Negate the exit status of a job
\subsection not-synopsis Synopsis
<tt>not COMMAND [OPTIONS...]</tt>
\subsection not-description Description
The \c not builtin is used to negate the exit status of another command.
\subsection not-example Example
The following code reports an error and exits if no file named spoon can be found.
<pre>
if not test -f spoon
echo There is no spoon
exit 1
end
</pre>

13
doc_src/open.txt Normal file
View File

@@ -0,0 +1,13 @@
\section open open - Open file in it's default application
\subsection open-synopsis Synopsis
<tt>open FILES...</tt>
\subsection open-description Description
The \c open command is used to open a file in it's default application. \c open is implemented using 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 systems default text editor.

23
doc_src/or.txt Normal file
View File

@@ -0,0 +1,23 @@
\section or or - Conditionally execute a command
\subsection or-synopsis Synopsis
<tt>or COMMAND1; COMMAND2</tt>
\subsection or-description Description
The \c or builtin is used to execute one command, and if it returns
non-zero status, also execute a second command.
\subsection or-example Example
The following code runs the \c make command to build a program, or if it fails, it runs <tt>make clean</tt>, which removes the files created by the build process
<pre>
or make; make clean
</pre>
\c or and \c and can be nested, as in this example, that attempts to build and install a program, and removed the files created by the build process on failiure
<pre>
or and make; make install; make clean
</pre>

8
doc_src/popd.txt Normal file
View File

@@ -0,0 +1,8 @@
\section popd popd
\subsection popd-synopsis Synopsis
<tt>popd</tt>
\subsection popd-description Description
<tt>popd</tt> removes the top directory from the directory stack and
cd's to the new top directory.

9
doc_src/prevd.txt Normal file
View File

@@ -0,0 +1,9 @@
\section prevd prevd
\subsection prevd-synopsis Synopsis
<tt>prevd [-l] [pos]</tt>
\subsection prevd-description Description
<tt>prevd</tt> moves backwards <tt>pos</tt> positions in the history of visited directories;
if the beginning of the history has been hit, a warning is printed. If the <tt>-l</tt> flag
is specified, the current history is also displayed.

9
doc_src/pushd.txt Normal file
View File

@@ -0,0 +1,9 @@
\section pushd pushd
\subsection pushd-synopsis Synopsis
<tt>pushd [DIRECTORY]</tt>
\subsection pushd-description Description
The <tt>pushd</tt> function adds DIRECTORY to the top of the directory stack
and makes it the current directory. Use <tt>popd</tt> to pop it off and and
return to the original directory.

25
doc_src/random.txt Normal file
View File

@@ -0,0 +1,25 @@
\section random random - Generate random number
\subsection random-synopsis Synopsis
<tt>random [SEED]</tt>
\subsection random-description Description
The \c random command is used to generate a random number in the
interval 0<=N<32767. If an argument is given, it is used to seed the
random number generator. This can be useful for debugging purposes,
where it can be desirable to get the same random number sequence
multiple times. If the random number generator is called without first
seeding it, the current time will be used as the seed.
\subsection random-example Example
The following code will count down from a random number to 1:
<pre>
for i in (seq (random) -1 1)
echo $i
sleep
end
</pre>

26
doc_src/read.txt Normal file
View File

@@ -0,0 +1,26 @@
\section read read - read line of input into variables
\subsection read-synopsis Synopsis
<tt>read [OPTIONS] [VARIABLES...]</tt>
\subsection read-description Description
The <tt>read</tt> builtin causes fish to read one line from standard
input and store the result in one or more environment variables.
- <tt>-e</tt> or <tt>--export</tt> specifies that the variables will be exported to subshells.
- <tt>-g</tt> or <tt>--global</tt> specifies that the variables will be made global.
- <tt>-pPROMPT_CMD</tt> or <tt>--prompt=PROMPT_CMD</tt> specifies that the output of the shell command PROMPT_CMD should be used as the prompt for the interactive mode prompt. The default prompt command is <tt>set_color green; echo read; set_color normal; echo "> "</tt>.
- <tt>-cCMD</tt> or <tt>--command=CMD</tt> specifies that the initial string in the interactive mode command buffer should be CMD.
Read starts by reading a single line of input from stdin, the line is
then tokenized using the <tt>IFS</tt> environment variable. Each variable
specified in <tt>VARIABLES</tt> is then assigned one tokenized string
element. If there are more tokens than variables, the complete
remainder is assigned to the last variable.
\subsection read-example Example
<tt>echo hello|read foo</tt>
Will cause the variable \$foo to be assigned the value hello.

22
doc_src/return.txt Normal file
View File

@@ -0,0 +1,22 @@
\section return return - Stop the innermost currently evaluated function
\subsection return-synopsis Synopsis
<tt>function NAME; [COMMANDS...] break [STATUS]; [COMMANDS...] end</tt>
\subsection return-description Description The \c return builtin is
used to halt a currently running function. It is usually added inside
of a conditional block such as an <a href="#if">if</a> statement or a
<a href="#switch">switch</a> statement to conditionally stop the
executing function and return to the caller.
- \c STATUS is the return status of the function. If unspecified, the status is set to 0.
\subsection return-example Example
The following code is an implementation of the false program as a fish builtin
<p>
<pre>function false
return 1
end</pre>
</p>

40
doc_src/set.txt Normal file
View File

@@ -0,0 +1,40 @@
\section set set - Handle environment variables.
\subsection set-synopsis Synopsis
<tt>set [OPTIONS] VARIABLE_NAME [VALUES...]</tt>
The <tt>set</tt> builtin causes fish to assign the variable <tt>VARIABLE_NAME</tt> the values <tt>VALUES...</tt>.
\subsection set-description Description
- <tt>-e</tt> or <tt>--erase</tt> causes the specified environment variables to be erased
- <tt>-U</tt> or <tt>--universal</tt> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <tt>-g</tt> or <tt>--global</tt> causes the specified environment variable to be made global. If this option is not supplied, the specified variable will dissapear when the current block ends
- <tt>-l</tt> or <tt>--local</tt> forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
- <tt>-n</tt> or <tt>--names</tt> List only the names of all defined variables
- <tt>-x</tt> or <tt>--export</tt> causes the specified environment variable to be exported to child processes
- <tt>-u</tt> or <tt>--unexport</tt> causes the specified environment not to be exported to child processes
If set is called with no arguments, the names and values of all
environment variables are printed.
If set is called with only one argument, the scope of the variable
with the given name will be changed as specified, but it's value will
remain the same. If the variable did not previously exist, it's value
will be an empty string.
If the \c -e or \c --erase option is specified, all the variables
specified by the following arguments will be erased
If a variable is set to more than one value, the variable will be an
array with the specified elements.
If the variable name is one or more array elements, such as <tt>PATH[1
3 7]</tt>, only those array elements specified will be changed.
\subsection set-example Example
<tt>set foo hi</tt> sets the value of the variable foo to be hi.
<tt>set -e smurf</tt> removes the variable \c smurf.
<tt>set PATH[4] ~/bin</tt> changes the fourth element of the \c PATH array to \c ~/bin

19
doc_src/set_color.txt Normal file
View File

@@ -0,0 +1,19 @@
\section set_color set_color - Set the terminal color
\subsection set_color-synopsis Synopsis
<tt>set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR]</tt>
\subsection set_color-description Description
Change 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.
- \c -b, \c --background Set the background color
- \c -h, \c --help Display help message and exit
- \c -v, \c --version Display version and exit
Calling <tt>set_color normal</tt> will set the terminal color to
whatever is the default color of the terminal.

19
doc_src/source.txt Normal file
View File

@@ -0,0 +1,19 @@
\section source . - Evaluate contents of file.
\subsection source-synopsis Synopsis
<tt>. FILENAME</tt>
\subsection source-description Description
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
evaluated by the current shell, which means that changes in
environment variables, etc., will remain.
\subsection source-example Example
<tt>. ~/.fish</tt>
causes fish to reread its initialization file.

37
doc_src/switch.txt Normal file
View File

@@ -0,0 +1,37 @@
\section switch switch - conditionally execute a block of commands
\subsection switch-synopsis Synopsis
<tt>switch VALUE; [case [WILDCARD...]; [COMMANDS...];...] end</tt>
\subsection switch-description Description
The \c switch statement is used to perform one of several blocks of
commands depending on whether a specified value equals one of several
wildcarded values.
\subsection switch-example Example
If the variable \$animal contins the name of an animal, the
following code would attempt to classify it:
<p>
<pre>
switch $animal
case cat
echo evil
case wolf dog human moose dolphin whale
echo mammal
case duck goose albatros
echo bird
case shark trout stingray
echo fish
end
</pre>
</p>
<p>
If the above code was run with \$animal set to \c whale, the output
would be \c mammal.
</p>

14
doc_src/tokenize.txt Normal file
View File

@@ -0,0 +1,14 @@
\section tokenize tokenize - tokenize a string
\subsection tokenize-synopsis Synopsis
<tt>tokenize [STRING...]</tt>
\subsection tokenize-description Description
- STRING is the string or list of strings to tokenize. Each token will be printed on a line by itself
- \c -e, \c --with-empty allow empty tokens
- \c -n, \c --no-empty ignore empty tokens (Default)
- <tt>-d DELIMITER</tt>, <tt>--delimiter=DELIMITER</tt> is the list of characters that will be used as delimiters. If unspecified, the IFS environment variable will be used as the delimiter string,
- \c -h, \c --help Display help message and exit
- \c -v, \c --version Display version and exit

13
doc_src/while.txt Normal file
View File

@@ -0,0 +1,13 @@
\section while while - perform a command multiple times
\subsection while-synopsis Synopsis
<tt>while CONDITION; COMMANDS; end</tt>
\subsection while-synopsis Synopsis
The <tt>while</tt> builtin causes fish to continually execute the command COMMANDS while the command CONDITION returns with status 0.
\subsection while-example Example
<tt>while test -f foo.txt; echo file exists; sleep 10; end</tt>
causes fish to print the line 'file exists' at 10 second intervals as long as the file foo.txt exists.