Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the environment variable MY_VAR to 'hello' using export.
Linux CLI
export MY_VAR=[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes can cause errors if the value has spaces or special characters.
Using uppercase without quotes sets a different value.
✗ Incorrect
The export command sets environment variables. To assign a string with spaces or special characters, use quotes. Here, 'hello' is correctly quoted with single quotes.
2fill in blank
mediumComplete the code to export the PATH variable by adding '/usr/local/bin' at the end.
Linux CLI
export PATH=$PATH[1]/usr/local/bin Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using semicolon ';' which is for Windows paths.
Using plus '+' or comma ',' which are invalid separators.
✗ Incorrect
In Linux, PATH entries are separated by colons ':'. To add a new directory, append it with a colon separator.
3fill in blank
hardFix the error in the code to export a variable named DATA_DIR with the value '/data/files'.
Linux CLI
export [1]='/data/files'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or mixed case variable names.
Using dashes '-' which are invalid in variable names.
✗ Incorrect
Environment variable names should be uppercase and cannot contain dashes. DATA_DIR is the correct format.
4fill in blank
hardFill both blanks to export a variable named CONFIG_PATH with the value '/etc/config'.
Linux CLI
export [1]=[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase variable names.
Not quoting the value.
✗ Incorrect
Variable names should be uppercase with underscores. The value should be quoted to handle special characters.
5fill in blank
hardFill all three blanks to export a variable named LIB_PATH by adding '/usr/lib' to the existing LIB_PATH.
Linux CLI
export [1]=$[2]:[3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names in export and reference.
Using wrong path or separator.
✗ Incorrect
To add a directory to an existing variable, use the variable name on both sides and separate with a colon. Here, LIB_PATH is updated by appending '/usr/lib'.