{ "q1": { "type": "order", "question": "\n
\nOrder the following networking utilities to match the descriptions\nbelow.\n
\n\n\n
\nNote: You may need to lookup additional resources for some of these commands.\n
\n", "responses": { "host": "host", "scp": "scp", "curl": "curl", "rsync": "rsync", "nmap": "nmap", "nc": "nc", "ping": "ping", "ip": "ip", "ss": "ss", "traceroute": "traceroute" } }, "q2": { "type": "blank", "question": "\n\nUse the find
command on the /etc
folder on\nstudent10.cse.nd.edu
to answer the following questions:\n
\n
Given the following output of ls -l
:
\n-rw-r--r-- 1 pbui pbui 23 Jan 18 15:39 README.md\n-rw-r--r-- 1 pbui pbui 155 Jan 25 01:15 exists.sh\n\n\n
And the following script, exists.sh
:
\n#!/bin/sh\n\nif test -e \"$1\"; then\n echo \"$1 exists!\"\nelse\n echo \"$1 does not exist!\"\nfi\n\n\n
\n
\nGiven the exists.sh
script in Q3, which of the\nfollowing statements are true (choose all that apply)?\n
#!/bin/sh
line specifies the file extension.",
"shebang": "The #!/bin/sh
line specifies the interpreter to use when the script is executed.",
"number": "The $1
represents the number 1
.",
"argument": "The $1
represents the first argument to the script.",
"variable": "The test -e
line checks if the number referenced by the variable exists.",
"file": "The test -e
line checks if the file referenced by the variable exists."
}
},
"q5": {
"type": "blank",
"question": "\nWe wish to create a new version of the exists.sh
script in\nQ3 with the following modifications:
\n
[
instead of test
for the conditional.1
) if one of the checks fails.\n\n
Fill in the missing code in the script below to complete this new\nversion of exists.sh
:
\n#!/bin/sh\n\n# Check if there are no arguments\nif [ \"____\" ____ 1 ]; then\n \u00a0\u00a0\u00a0echo \"Usage: exists.sh file0...\"\n \u00a0\u00a0\u00a0exit ____\nfi\n\n# Check each command line argument\nEXITCODE=____\nfor arg in \"____\"; do\n # Check if argument exists\n if [ ____ \"____\" ]; then\n echo \"____ exists!\"\n else\n echo \"____ does not exist!\"\n EXITCODE=____\n fi\ndone\n\nexit ____\n\n" } }