Indeed, as Daniel notes, there are spaces after one of your "continuation of line" backslash characters \
.
The first thing I did was edit your post to make use of the fancy backtick functionality, to put code blocks in code formatting. Please see here about that.
Then I highlighted your AP code text, which shows where spaces are. Look here in line 45 of the code block, and you will see spaces to the right of \
:
That is the offending line.
This is a case of the error message not really telling you exactly what is happening, which is annoying. But seeing command not found
in a situation like this is not uncommon (happens to me, too!). Note that the non-found command was about regress_stim_labels
, among others---that is the first command after the offending spaces. That is because having a space after \
breaks the continual read as a single line, so the shell things that line 46 starts a new command, but then it finds it doesn't recognize that command.
Rick's program file_tool can help point these things out in scripts, as well as subtle non-ascii characters (like -
or '
that are actually not ASCII). For example, running:
file_tool -show_bad_all -infiles SCRIPT
... can be helpful as a check over scripts.
--pt