It always helps one debug one's own code by trying to explain the code to somebody else. I have a workaround now. I'm not sure WHY this workaround succeeds, or more specifically, why it's needed in that specific situation, but here it is.

I had to change the grep command to this:

Code:
grep -o -E -m 1 '[0-9][0-9]*:[0-9][0-9].{1,3}[AP]M'


What I did was turn on Extended regex ("-E), then allowed for 1-3 of any character between the time digits and the AM/PM part ("{1,3}").

What this tells me is that, when running under the Synology Task Scheduler, that weird unicode space is acting like multiple characters to the regex. Which sort of makes sense. But then why didn't it also fail at shell when I ran the same file from the same location after SSH'ing into the Synology?
_________________________
Tony Fabris