Shell Scripting for Beginners - Hint answer is not useful

I tried answering and modifying the script and also check the hint answer at the path but doesn’t work and the hint answer location file also doesn’t give any hint as the file is same.

Details below:
Update the script to use 2 command line variables $1 and $2 for country and capital respectively. When the script is executed it should now print the country and its capital using the values passed in as command line arguments.

eg: ./ Nigeria Abuja should print Capital city of Nigeria is Abuja


  • info_outlineHint

Check the answer file at /tmp/assets/

1 Like

Lab is super easy so far but this question is extremely confusing and making me beat my head to the wall… I tried almost all methods but don’t know what you are trying to ask me to do here… Can you please elaborate… And it gets more confusing when i check the hint answer where the file is same with no changes in the hint answer… then what is reason for having the answer when there is no answer but the same file… appreciate your quick response as I’m learning on a daily basis and don’t want to give a gap between learning…
Thanks -Viq

1 Like

@viquar22 Can you please mention the Lab name which you are facing the issue?

Lab: Command line argument & inputs

Hi @viquar22,

Although the lab is marking my answer as incorrect, my script is running correctly. Check this out for reference:

echo "Capital city of $2 is $1" 

Then run ./ Abuja Nigeria


If you run ./ a b c d e, then $1 will be a, $2 will be b, etc. In shells with functions, $1 may serve as the first function parameter, and so forth.

Hope this helps:-)

I passed it with the help of the comments above and experimenting.

echo “Capital city of $1 is $2”

The positions of the $1 and $2 matter in the echo command