quizzes/posix-shell: Add a preliminary POSIX shell language quiz
[quizzer.git] / quizzes / posix-shell.json
1 {
2         "version": "0.1",
3         "questions": [
4                 {
5                         "class": "ScriptQuestion",
6                         "interpreter": "sh",
7                         "id": "quoting spaces",
8                         "prompt": "call `ls` and pass it two arguments: `a` and `b c`",
9                         "answer": "ls a 'b c'",
10                         "help": "http://pubs.opengroup.org/onlinepubs/009696699/utilities/xcu_chap02.html#tag_02_02"
11                 },
12                 {
13                         "class": "ScriptQuestion",
14                         "interpreter": "sh",
15                         "id": "echo constant",
16                         "prompt": "print the string `hello, world` to stdout",
17                         "answer": "echo 'hello, world'",
18                         "help": "http://pubs.opengroup.org/onlinepubs/009696699/utilities/echo.html"
19                 },
20                 {
21                         "class": "ScriptQuestion",
22                         "interpreter": "sh",
23                         "id": "parameter expansion",
24                         "prompt": "print the contents of the PATH variable to stdout",
25                         "answer": "echo \"$PATH\"",
26                         "help": "http://pubs.opengroup.org/onlinepubs/009696699/utilities/xcu_chap02.html#tag_02_06_02",
27                         "dependencies": [
28                                 "echo constant"
29                                 ]
30                 },
31                 {
32                         "class": "ScriptQuestion",
33                         "interpreter": "sh",
34                         "id": "variable assign constant",
35                         "prompt": "set the ABC variable to the string `xyz`",
36                         "answer": "ABC='xyz'",
37                         "teardown": [
38                                 "echo \"ABC: '${ABC}'\""
39                                 ],
40                         "help": "http://tldp.org/LDP/abs/html/varassignment.html"
41                 },
42                 {
43                         "class": "ScriptQuestion",
44                         "interpreter": "sh",
45                         "prompt": "prepend the string `/some/path:` to the PATH variable",
46                         "answer": "PATH=\"/some/path:$PATH\"",
47                         "teardown": [
48                                 "echo \"PATH: '${PATH}'\""
49                                 ],
50                         "help": "",
51                         "dependencies": [
52                                 "variable assign constant"
53                                 ]
54                 }
55         ]
56 }