od_bloaty: fix debug code
[oweals/busybox.git] / shell / hush_doc.txt
index b2fd2442694c0c38979c44401d040826a3c962ca..c68dc2416be089ccf482f9701e04a06435e0d92e 100644 (file)
@@ -2,9 +2,10 @@
 
        Command parsing
 
-Command parsing results in "pipe" structures. "Pipe" structure
-does not always correspond to what sh language calls "pipe",
-it also controls execution of if, while, etc statements.
+Command parsing results in a list of "pipe" structures.
+This list correspond not only to usual "pipe1 || pipe2 && pipe3"
+lists, but it also controls execution of if, while, etc statements.
+Every such statement is a list for hush. List consists of pipes.
 
 struct pipe fields:
   smallint res_word - "none" for normal commands,
@@ -18,13 +19,13 @@ Blocks of commands { pipe; pipe; } and (pipe; pipe) are represented
 as one pipe struct with one progs[0] element which is a "group" -
 struct child_prog can contain a list of pipes. Sometimes these
 "groups" are created implicitly, e.g. every control
-statement (if, while, etc) sits inside its own "pipe" struct).
+statement (if, while, etc) sits inside its own group.
 
 res_word controls statement execution. Examples:
 
 "echo Hello" -
 pipe 0 res_word=NONE followup=SEQ prog[0] 'echo' 'Hello'
-pipe 1 res_word=NONE followup=SEQ
+pipe 1 res_word=NONE followup=SEQ
 
 "echo foo || echo bar" -
 pipe 0 res_word=NONE followup=OR  prog[0] 'echo' 'foo'
@@ -41,6 +42,10 @@ res_word=NONE followup=SEQ
   pipe 4 res_word=NONE followup=(null)
 pipe 1 res_word=NONE followup=SEQ
 
+Above you see that if is a list, and it sits in a {} group
+implicitly created by hush. Also note two THEN res_word's -
+it is explained below.
+
 "if true; then { echo Hello; true; }; fi" -
 pipe 0 res_word=NONE followup=SEQ
  prog 0 group {}:
@@ -51,7 +56,7 @@ pipe 0 res_word=NONE followup=SEQ
     pipe 1 res_word=NONE followup=SEQ prog[0] 'true'
     pipe 2 res_word=NONE followup=SEQ
   pipe 2 res_word=NONE followup=(null)
-pipe 1 res_word=NONE followup=SEQ
+pipe 1 res_word=NONE followup=SEQ
 
 "for v in a b; do echo $v; true; done" -
 pipe 0 res_word=NONE followup=SEQ
@@ -92,7 +97,7 @@ pipe 0 res_word=NONE followup=1 SEQ
   pipe 5 res_word=CASEI followup=SEQ prog[0] 'cmd3'
   pipe 6 res_word=ESAC followup=SEQ
   pipe 7 res_word=NONE followup=(null)
-pipe 1 res_word=NONE followup=SEQ
+pipe 1 res_word=NONE followup=SEQ
 
 
 2008-01