diff options
Diffstat (limited to 'shell/hush_doc.txt')
-rw-r--r-- | shell/hush_doc.txt | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/shell/hush_doc.txt b/shell/hush_doc.txt index ec5dd00f2..b2fd24426 100644 --- a/shell/hush_doc.txt +++ b/shell/hush_doc.txt | |||
@@ -72,10 +72,32 @@ Dummy trailing pipes with no commands are artifacts of imperfect | |||
72 | parsing algorithm - done_pipe() appends new pipe struct beforehand | 72 | parsing algorithm - done_pipe() appends new pipe struct beforehand |
73 | and last one ends up empty and unused. | 73 | and last one ends up empty and unused. |
74 | 74 | ||
75 | "for" and "case" statements (ab)use progs[] to keep their data | ||
76 | instead of argv vector progs[] usually do. "for" keyword is forcing | ||
77 | pipe termination after first word, which makes hush see | ||
78 | "for v in..." as "for v; in...". "case" keyword does the same. | ||
79 | Other judiciuosly placed hacks make hush see | ||
80 | "case word in a) cmd1;; b) cmd2;; esac" as if it was | ||
81 | "case word; match a; cmd; match b; cmd2; esac" | ||
82 | ("match" is a fictitious keyword here): | ||
83 | |||
84 | "case word in a) cmd1;; b) cmd2; esac" - | ||
85 | pipe 0 res_word=NONE followup=1 SEQ | ||
86 | prog 0 group {}: | ||
87 | pipe 0 res_word=CASE followup=SEQ prog[0] 'word' | ||
88 | pipe 1 res_word=MATCH followup=SEQ prog[0] 'a' | ||
89 | pipe 2 res_word=CASEI followup=SEQ prog[0] 'cmd1' | ||
90 | pipe 3 res_word=MATCH followup=SEQ prog[0] 'b' | ||
91 | pipe 4 res_word=CASEI followup=SEQ prog[0] 'cmd2' | ||
92 | pipe 5 res_word=CASEI followup=SEQ prog[0] 'cmd3' | ||
93 | pipe 6 res_word=ESAC followup=SEQ | ||
94 | pipe 7 res_word=NONE followup=(null) | ||
95 | pipe 1 res_word=NONE followup=1 SEQ | ||
96 | |||
75 | 97 | ||
76 | 2008-01 | 98 | 2008-01 |
77 | 99 | ||
78 | This is how hush runs commands: | 100 | Command execution |
79 | 101 | ||
80 | /* callsite: process_command_subs */ | 102 | /* callsite: process_command_subs */ |
81 | generate_stream_from_list(struct pipe *head) - handles `cmds` | 103 | generate_stream_from_list(struct pipe *head) - handles `cmds` |