Shell Variables   «Prev  Next»

Shell Variables and Environment Variables - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 

1. How can environment variables be accessed within a shell script?
Please select the best answer.
  A. By using the set command
  B. By using the export command
  C. By referring to the variable name preceded by a dollar sign
  D. By referring to the variable name within any echo command

2. What is the HOME environment variable?
Please select the best answer.
  A. A system-defined environment variable
  B. A positional parameter used with all system accounts
  C. A special variable that refers to network settings
  D. A variable that is not returned to the parent shell

3. What does the #$ system variable refer to?
Please select the best answer.
  A. The process ID of the script being run
  B. All of the parameters on the command line (as a single string of text)
  C. The path of the shell interpreter used to execute the script
  D. The number of arguments in the command line that started the script.

4. Which of the following statements are true of positional parameters?
Please select all the correct answers.
  A. They can be checked for validity before proceeding with a script.
  B. They are referenced by a number preceded by a dollar sign.
  C. They can be used in place of environment variables.
  D. They can be used within any command in a shell script.