I'm seeing this error from my tcsh script and I can't figure out why.
Script:
#!/usr/bin/env tcsh
foreach n (0 1)
set PERL_CMD = "perl -e 'print qq^RUNNING^; exit ${n} '"
echo "PERL_CMD:\n${PERL_CMD}"
${PERL_CMD}
echo
end
Result:
[]$ ./test_perl_e.csh
PERL_CMD:
perl -e 'print qq^RUNNING^; exit 0 '
Can't find string terminator "'" anywhere before EOF at -e line 1.
PERL_CMD:
perl -e 'print qq^RUNNING^; exit 1 '
Can't find string terminator "'" anywhere before EOF at -e line 1.
Running either of those PERL_CMD on the command line works fine:
[]$ perl -e 'print qq^RUNNING^; exit 1 '
RUNNING[]$
When I embed into a tcsh script, it echo's back fine. However when I try to run it, it's broken.
I've tried a bunch of variations, but I'm stumped. What did I do wrong?
Using perl/5.24
[]$ perl -v
This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux