LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem to running command from perl (https://www.linuxquestions.org/questions/linux-newbie-8/problem-to-running-command-from-perl-4175415260/)

politr 07-06-2012 11:18 AM

problem to running command from perl
 
Dear all,
I'm trying to run the following command using perl
$SCHRODINGER/run rmsd.py -asl "not atom.element H" filename1.mol2 /mml/nfs04/reginap/renamed/filename2.mol2
this command works perfect from linux, however when I try to execute it from perl
$cmd = "$SCHRODINGER/run rmsd.py -asl "not atom.element H" filename1.mol2 /mml/nfs04/reginap/renamed/filename2.mol2";
$rmsd = system($cmd);
I'm getting the following error:
syntax error at calc_RMSD_withShrodinger.pl line 22, near ""$SCHRODINGER/run rmsd.py -asl "not "
Execution of calc_RMSD_withShrodinger.pl aborted due to compilation errors.
I tried different ways like putting \ before "not" and using `` instead of system but nothing worked.
I will appreciate very much any help.
Thanks
Regina

MensaWater 07-06-2012 11:33 AM

You're quoting is confused perhaps because you're using double quotes within double quotes.

Maybe using single quotes around the whole command:
$cmd = '$SCHRODINGER/run rmsd.py -asl "not atom.element H" filename1.mol2 /mml/nfs04/reginap/renamed/filename2.mol2';

Or escaping the internal set of double quotes:
$cmd = "$SCHRODINGER/run rmsd.py -asl \"not atom.element H\" filename1.mol2 /mml/nfs04/reginap/renamed/filename2.mol2";

chrism01 07-08-2012 07:40 PM

I'd use single quotes here, as it's an absolute string (no vars)
Code:

"not atom.element H"
# change to
'not atom.element H'

Your qn looks like you've tried backquotes (`) which would not be a good idea...


All times are GMT -5. The time now is 04:15 PM.