in reply to From chat to here :) chdir() and test -f issues.

I'm only guessing here, but I think that the user that is running the script is not able to see the file, while the user that you are running the diagnostics under can. An easy way to diagnose this is to 'su' to that user and see if you can see those files in the shell. The harder way is to dump a readdir() listing to STDERR.

This might be because a single directory somewhere along that path is not mode 0755, but perhaps 0700 or somesuch. In order to get into the final directory, you have to enter each in turn.

As an aside, it is odd that you list the code $HOME/$gamedir/maps/$mapname.bsp in no fewer than three places in your code. If you were to change one, for whatever reason, the other two would be desynchronized (read: not working). A good idea is to warn with the actual thing you were testing, not a simulation.