aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/begin.txt
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-09-20 23:31:55 +1000
committerGravatar axel <axel@liljencrantz.se>2005-09-20 23:31:55 +1000
commit7ddecde54372c25fcf526e2d24807c5dac9800aa (patch)
tree1bff6e0ccd096836adb74529d53a6debcf45375b /doc_src/begin.txt
parent149594f974350bb364a76c73b91b1d5ffddaa1fa (diff)
Add subdirectories
darcs-hash:20050920133155-ac50b-9a14c6c664dd03afbe8e15e7c7998fcfb5c3c750.gz
Diffstat (limited to 'doc_src/begin.txt')
-rw-r--r--doc_src/begin.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc_src/begin.txt b/doc_src/begin.txt
new file mode 100644
index 00000000..02284f21
--- /dev/null
+++ b/doc_src/begin.txt
@@ -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>