I'm trying to execute something like this:
exec perl -i -pe 's/\015/\012/g' '${file}'
in my expect script and I get:
error "invalid command name \"perl\".
however, if I run
perl -i -pe 's/\015/\012/g' "/Users/Shared/menu-items.txt"
directly in my terminal, it runs fine. I'm an exec/shell novice, so hopefully this is an easy one. Any help is much appreciated!
Try without exec in script.
I removed exec, so the line is now:
perl -i -pe 's/\015/\012/g' "/Users/Shared/menu-items.txt"
error "invalid command name \"perl\"
while executing...
execute the below command
which perl
and you will get a output like /bin/perl or something....
then replce the perl with the absolute path of "which perl" output
/usr/bin/perl -i -pe 's/\015/\012/g' "/Users/Shared/menu-items.txt"
error "invalid command name \"/usr/bin/perl\"
while executing
\"/usr/bin/perl -i -pe 's/\\015/\\012/g' \"/Users/Shared/menu-items.txt\"\"
Perhaps the error is too vague. Maybe it doesn't like something else about the syntax (even though that one line runs fine in the terminal)