LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 12:18 PM   #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, 12:33 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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, 08:40 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
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 01:34 AM
running shell command in Perl script deci007 Linux - Newbie 5 02-07-2010 07:12 PM
Perl: Running Command line apps in background and capturing output s0l1dsnak3123 Programming 8 03-28-2008 02:24 PM
Problem running perl files fuelinjection Linux - General 2 01-20-2004 12:15 AM
Have problem running .pl perl script in apache adrianmak Linux - Software 4 11-10-2003 10:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:03 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
Open Source Consulting | Domain Registration