Learn Bash Scripting by Building Five Programs - Build Five Programs

Tell us what’s happening:
I am stuck on a milestone, I think it is an error from your side because i have tried all ways to solve and go ahead but anything doesn’t seem to work, the question is - " One of the conditions was true so it printed 0 . I think that’s enough of a detour. Back in your script, change the if condition to check if the first argument is greater than zero so you can be sure it’s something you can count down from."
I tried changing the code block to “if [[ $1 -gt 0 ]]” and keeping the rest same but it doesn’t work.
This task might sound basic ,I agree it’s basic but i do need help, I’m literally stuck for hours, it’s really irritating.

Your code so far

Program that counts down to zero from a given argument

if [[ $1 -gt 0 ]]
echo true
echo false

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Learn Bash Scripting by Building Five Programs - Build Five Programs

Link to the challenge:

Could you check what’s printed in terminal when you run:

./countdown.sh 1
./countdown.sh 0

It’s saying permission denied
I tried giving it permission with “chmod a+rw countdown.sh” but it’s still saying permission denied.

solved it thnx, It was execution permission it was asking for.

1 Like

Had the same problem. some step earlier I incorrectly insert
chmod -x ./countdown.sh
instead of
chmod +x ./countdown.sh
like it was request in the script. So I remove the executing permission.
I reinsert the permission command and everithing goes well!