LPI
010-160 · Question #92
The file script.sh in the current directory contains the following content: #!/bin/bash echo $MYVAR The following commands are used to execute this script: MYVAR=value ./script.sh The result is an emp
Sign in or unlock 010-160 to reveal the answer and full explanation for question #92. The question stem and answer options stay visible for context.
The Power of the Command Line
Question
The file script.sh in the current directory contains the following content:
#!/bin/bash
echo $MYVAR
The following commands are used to execute this script:
MYVAR=value
./script.sh
The result is an empty line instead of the content of the variable MYVAR. How should MYVAR be set in order to make script.sh display the content of MYVAR?
Options
- A!MYVAR=value
- Benv MYVAR=value
- CMYVAR=value
- D$MYVAR=value
- Eexport MYVAR=value
Unlock 010-160 to see the answer
You've previewed enough free 010-160 questions. Unlock 010-160 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#export command#environment variables#variable scope#shell scripting