2005-09-20 21:31:55 +08:00
|
|
|
\section for for - perform a set of commands multiple times.
|
|
|
|
|
|
|
|
\subsection for-synopsis Synopsis
|
2014-08-01 20:25:41 +08:00
|
|
|
\fish{synopsis}
|
2014-08-01 10:37:32 +08:00
|
|
|
for VARNAME in [VALUES...]; COMMANDS...; end
|
|
|
|
\endfish
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
\subsection for-description Description
|
2014-08-01 10:37:32 +08:00
|
|
|
`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
|
2006-09-19 22:52:03 +08:00
|
|
|
not be executed at all.
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
\subsection for-example Example
|
2014-08-01 10:37:32 +08:00
|
|
|
\fish
|
|
|
|
for i in foo bar baz; echo $i; end
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
# would output:
|
2006-09-19 22:52:03 +08:00
|
|
|
foo
|
2005-09-20 21:31:55 +08:00
|
|
|
bar
|
2006-09-19 22:52:03 +08:00
|
|
|
baz
|
2014-08-01 10:37:32 +08:00
|
|
|
\endfish
|
2005-09-20 21:31:55 +08:00
|
|
|
|