quizzes/posix-shell: Add a preliminary POSIX shell language quiz
authorW. Trevor King <wking@tremily.us>
Tue, 5 Feb 2013 19:37:21 +0000 (14:37 -0500)
committerW. Trevor King <wking@tremily.us>
Tue, 5 Feb 2013 19:37:21 +0000 (14:37 -0500)
quizzes/posix-shell.json [new file with mode: 0644]

diff --git a/quizzes/posix-shell.json b/quizzes/posix-shell.json
new file mode 100644 (file)
index 0000000..e0693f7
--- /dev/null
@@ -0,0 +1,56 @@
+{
+       "version": "0.1",
+       "questions": [
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "quoting spaces",
+                       "prompt": "call `ls` and pass it two arguments: `a` and `b c`",
+                       "answer": "ls a 'b c'",
+                       "help": "http://pubs.opengroup.org/onlinepubs/009696699/utilities/xcu_chap02.html#tag_02_02"
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "echo constant",
+                       "prompt": "print the string `hello, world` to stdout",
+                       "answer": "echo 'hello, world'",
+                       "help": "http://pubs.opengroup.org/onlinepubs/009696699/utilities/echo.html"
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "parameter expansion",
+                       "prompt": "print the contents of the PATH variable to stdout",
+                       "answer": "echo \"$PATH\"",
+                       "help": "http://pubs.opengroup.org/onlinepubs/009696699/utilities/xcu_chap02.html#tag_02_06_02",
+                       "dependencies": [
+                               "echo constant"
+                               ]
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "variable assign constant",
+                       "prompt": "set the ABC variable to the string `xyz`",
+                       "answer": "ABC='xyz'",
+                       "teardown": [
+                               "echo \"ABC: '${ABC}'\""
+                               ],
+                       "help": "http://tldp.org/LDP/abs/html/varassignment.html"
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "prompt": "prepend the string `/some/path:` to the PATH variable",
+                       "answer": "PATH=\"/some/path:$PATH\"",
+                       "teardown": [
+                               "echo \"PATH: '${PATH}'\""
+                               ],
+                       "help": "",
+                       "dependencies": [
+                               "variable assign constant"
+                               ]
+               }
+       ]
+}