From: W. Trevor King Date: Tue, 5 Feb 2013 19:37:21 +0000 (-0500) Subject: quizzes/posix-shell: Add a preliminary POSIX shell language quiz X-Git-Tag: v0.1~52 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cd086cab49a3fd68970878068ebef9aab4a0cd21;p=quizzer.git quizzes/posix-shell: Add a preliminary POSIX shell language quiz --- diff --git a/quizzes/posix-shell.json b/quizzes/posix-shell.json new file mode 100644 index 0000000..e0693f7 --- /dev/null +++ b/quizzes/posix-shell.json @@ -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" + ] + } + ] +}