Number of occurrences.sh is giving error

I am unable to understand the error in number_of_occurrences.sh
here it is

Did you find the solution? I’m facing the same problem.

No…when I submitted it for the first time it is showing testcase passed but on 2nd time it was showing this error and I haven’t changed anything in the code.

1 Like

check the code. i was getting such error in list_files.sh and error was in the code itself.

Make sure your command is working irrespective of the folder !

Sir, i already checked it.First time when i submitted it was working fine.

just write exit 0 in the number_of_occurences.sh file.

Where am I supposed to write this command? Am I supposed to write it as the last line of my bash script?

Thanks. Including exit 0 at the end of the script got my code accepted.
But can someone explain why was it needed ,and only in this script?

hey, you don’t have to do exit 0
as exit 0 will return output code 0 due to which your code will pass the assessment but still there will be fault in your code
Your goal is to understand the solution not to use some tricks…
for this problem just focus on this line your command will be working irrespective of the directory
try to go into workspace directory and then run the command in the terminal if it will give the correct output then your answer is correct

it is working irrespective of folder when i am running locally but giving an error on submission.

ok just check that your output must be integer no space or new line