In ksh88, I can source a file using the "dot" command, like
However, if source.ksh doesn't exist, I want to trap the error.
So I tried this:
#!/bin/ksh trap "echo 'Source Not Found'; exit 1" ERR . test2.ksh
But the trap never displays the error message, the script returns with:
./test.ksh: test2.ksh: not found.
I even tried just using
trap without any signals and it still doesn't catch the error.
Is there any way to catch this error? I must use ksh88 for this script. Bash answers are useless for this question.
I am aware that I can test for the existence of the file beforehand, I was just hoping there would be a way to trap this error without having to do that, as there are a bunch of these includes in my script.