summaryrefslogtreecommitdiff
path: root/shell/hush_doc.txt
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-14 08:26:47 +0000
committerDenis Vlasenko2008-07-14 08:26:47 +0000
commit757361f9f58e120ddb9855fa0f50e12b921c37f0 (patch)
treef3f7bbe64e3e0dcf394205b7c5c8fa6046c38d1e /shell/hush_doc.txt
parent395ae452165a607c6b5bc4623225516044619616 (diff)
downloadbusybox-757361f9f58e120ddb9855fa0f50e12b921c37f0.zip
busybox-757361f9f58e120ddb9855fa0f50e12b921c37f0.tar.gz
hush: fix "... pattern) cmd;; esac" case
Diffstat (limited to 'shell/hush_doc.txt')
-rw-r--r--shell/hush_doc.txt24
1 files changed, 23 insertions, 1 deletions
diff --git a/shell/hush_doc.txt b/shell/hush_doc.txt
index ec5dd00..b2fd244 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
parsing algorithm - done_pipe() appends new pipe struct beforehand
and last one ends up empty and unused.
+"for" and "case" statements (ab)use progs[] to keep their data
+instead of argv vector progs[] usually do. "for" keyword is forcing
+pipe termination after first word, which makes hush see
+"for v in..." as "for v; in...". "case" keyword does the same.
+Other judiciuosly placed hacks make hush see
+"case word in a) cmd1;; b) cmd2;; esac" as if it was
+"case word; match a; cmd; match b; cmd2; esac"
+("match" is a fictitious keyword here):
+
+"case word in a) cmd1;; b) cmd2; esac" -
+pipe 0 res_word=NONE followup=1 SEQ
+ prog 0 group {}:
+ pipe 0 res_word=CASE followup=SEQ prog[0] 'word'
+ pipe 1 res_word=MATCH followup=SEQ prog[0] 'a'
+ pipe 2 res_word=CASEI followup=SEQ prog[0] 'cmd1'
+ pipe 3 res_word=MATCH followup=SEQ prog[0] 'b'
+ pipe 4 res_word=CASEI followup=SEQ prog[0] 'cmd2'
+ 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=1 SEQ
+
2008-01
- This is how hush runs commands:
+ Command execution
/* callsite: process_command_subs */
generate_stream_from_list(struct pipe *head) - handles `cmds`