A person might feel a sense of regret upon picking the wrong numbers in a lottery. But there is no reason for this regret, because before the lottery numbers were drawn, there was no way to figure out what the right numbers were.
The same kind of thing applies to unit testing for trying to predict problems for a new script you write. Successfully speculating about the kind of bugs you will have is rare, like winning the lottery, which means that writing tests as a precautionary measure is not worth the effort. But what makes the idea of writings unit tests seductive is that after the fact, whenever X goes wrong, you can always say "this wouldn't have happened if you had written a unit test that tests for X!". And so the entire software world is forced to spend an enormous amount of time speculating about potential problems and writing unit tests because of this fallacy.
To see the fallacy in action just look at all the responses to this comment on reddit:
Saying "this wouldn't have happened if you had written a unit test that tests for X!", is like saying "You would have won the lottery if you had picked numbers XYZ".