system() and "Unterminated quoted string" error


I’m using the system() command to run some perl oneliners in between the mothur commands. I noticed that I can’t have commas in the Perl script, or I get the error
sh: 1: Syntax error: Unterminated quoted string


mothur > system(perl -e 'print "foo bar"')

foo bar

mothur > system(perl -e 'print "foo", "bar"')

sh: 1: Syntax error: Unterminated quoted string

Both versions work fine in bash directly. For now I’m just replacing commas in my Perl with => but that’s kinda ugly…
This is mothur v.1.31.2 running under Ubuntu, same error in bash or zsh.


Bumping this because I’m having the same problem in mothur 1.32.1.

I’m trying to reformat a .taxonomy file like such:

cat test.taxonomy | tr ';' '\t' | cut -f 1,3- > test_tax.tsv

Works on the command line, doesn’t inside a system() call.

Easy workaround for anyone else hitting this bug: put the commands in a .sh file, then just: