Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-06-2012, 12:18 PM   #1
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 -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 -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 line 22, near ""$SCHRODINGER/run -asl "not "
Execution of 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.
Old 07-06-2012, 12:33 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,064
Blog Entries: 14

Rep: Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248
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 -asl "not atom.element H" filename1.mol2 /mml/nfs04/reginap/renamed/filename2.mol2';

Or escaping the internal set of double quotes:
$cmd = "$SCHRODINGER/run -asl \"not atom.element H\" filename1.mol2 /mml/nfs04/reginap/renamed/filename2.mol2";
Old 07-08-2012, 08:40 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
I'd use single quotes here, as it's an absolute string (no vars)
"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...


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:36 AM.

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