Variables shell script- Q3

Hi Team, I tried to perform the necessary solutions for this question but the answer is getting wrong, can you please help me with the correct solution for below question that will be helpful.

Question:-
Another script by the name print-uptime.sh is placed in your home directory at /home/bob .

It must print the uptime of the system as expected. However it’s not working’. Please inspect and fix the problem with the script.

Answer :

Terminal

uptime=uptime

echo “The uptime of the system is $uptime”

Hi @Afshan

The bug you need to fix with this script is with the variable name. - (dash) character is not a valid character in variable names. Replace with _ (underscore) to pass the question.

1 Like