LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-06-2012, 11:18 AM   #1
politr
LQ Newbie
 
Registered: Jul 2012
Posts: 1

Rep: Reputation: Disabled
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
 
Old 07-06-2012, 11:33 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,870
Blog Entries: 14

Rep: Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112
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";
 
Old 07-08-2012, 07:40 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with modules in perl running on linux RHEL 5.4 kingston Linux - Newbie 4 04-19-2011 12:34 AM
running shell command in Perl script deci007 Linux - Newbie 5 02-07-2010 06:12 PM
Perl: Running Command line apps in background and capturing output s0l1dsnak3123 Programming 8 03-28-2008 01:24 PM
Problem running perl files fuelinjection Linux - General 2 01-19-2004 11:15 PM
Have problem running .pl perl script in apache adrianmak Linux - Software 4 11-10-2003 09:31 AM


All times are GMT -5. The time now is 01:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration