coding using bash on codingame has some peculiarities. to be fair bash has some peculiarities but on codingame they get a little boost. not least because debugging is quite limited in the codingame ide. but also because the validators run differently from the test cases.
here the things that i stumbled upon on my adventures coding using bash on codingame:
if working with the filesystem (creating files and directories) you have to take care to delete the files. this is because codingame does not give your code a clean working directory for each run. instead the second run will get the files left over from the first run.
the catch: the test runs will get a clean working directory. the validators will not.
there is a (relatively low) limit on file descriptors (and/or probably the other resources controlled by ulimit). so you can’t have very many files open at once. this probably won’t happen often but still i hit this limit at least once.
https://www.codingame.com/forum/t/community-puzzle-1d-spreadsheet/110120/20
the input does not always have a last newline. this will mess up the typical while read
idiom for reading lines from stdin. because it will silently not handle the last line.
the catch: some provided test cases and validators are missing the last newline. but if you copy the input from the provided test to the custom test feature then it will always have a last newline.
https://www.codingame.com/forum/t/community-puzzle-tree-paths/186993/44