27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
Answer the following questions to describe your code submission. Please keep
|
|
all lines to a maximum of 80 characters wide.
|
|
|
|
1 - Explain how you are keeping track of the return code for use in echo $?.
|
|
|
|
After each process is executed in the shell's main loop, the "?" key is
|
|
set to the return code of that process.
|
|
|
|
2 - Briefly describe how you are storing or deleting environment variales.
|
|
|
|
Environment variables are stored directly in the hashmap. Export sets
|
|
the value to the corresponding key in the hashmap. Unset removes the
|
|
key from the hasmap. Echo finds the value in the hashmap based on the key.
|
|
|
|
3 - Consider the following three command lines:
|
|
$ echo ${VAR}
|
|
$ echo {VAR}
|
|
$ echo ${VAR
|
|
Briefly explain how your code processes each. Does your code handle bad
|
|
input strings?
|
|
|
|
In the first case, the correct environment variable is printed.
|
|
In the second case the literal string {VAR} is printed.
|
|
In the third case nothig is printed.
|
|
In the first two cases the exit code of echo is 0 because they are both
|
|
valid inputs to echo, but the third exits with a code 1 because the
|
|
syntax is invalid. |