script advice

N

nkomli

I'm trying to use a script to automate some Terminal command line work
I'm doing. Basically I'm inputting a filename, then running one set of
files with the sander program to generate an rst file used to start a
loop that will run the sander program again five times with other sets
of files. Since I don't have experience making scripts I'd like to show
what I've got so far to see if there are any mistakes. I don't know if
the filenames I'm using would work...


#!/bin/csh
set AMBERHOME="/usr/local/AMBER8"
set MDSTARTJOB=2
set MDENDJOB=6
set MDCURRENTJOB=$MDSTARTJOB
set MDINPUT=1

echo -n "enter filename"
$filename=<STDIN>
chop($filename);

echo -n "Starting Script at: "
date
echo ""


echo -n "Warming started at: "
date
$AMBERHOME/exe/sander -O -i hot.in \
-o hot$filename.out \
-p $filename.prmtop \
-c $filename.rst \
-r $filename$MDINPUT.rst \
-x hot$filename.mdcrd

echo -n "Job hot$filename finished at: "
date



while ( $MDCURRENTJOB <= $MDENDJOB )
echo -n "Job $MDCURRENTJOB started at: "
date
@ MDINPUT = $MDCURRENTJOB - 1
$AMBERHOME/exe/sander -O -i mdp53.in \
-o $filename$MDCURRENTJOB.out \
-p $filename.prmtop \
-c $filename$MDINPUT.rst \
-r $filename$MDCURRENTJOB.rst \
-x $filename$MDCURRENTJOB.mdcrd
gzip -9 -v $filename$MDCURRENTJOB.mdcrd
echo -n "Job $MDCURRENTJOB finished at: "
date
@ MDCURRENTJOB = $MDCURRENTJOB + 1
end
echo "ALL DONE"
 
B

Brian Wakem

I'm trying to use a script to automate some Terminal command line work
I'm doing. Basically I'm inputting a filename, then running one set of
files with the sander program to generate an rst file used to start a
loop that will run the sander program again five times with other sets
of files. Since I don't have experience making scripts I'd like to show
what I've got so far to see if there are any mistakes. I don't know if
the filenames I'm using would work...


#!/bin/csh


Wrong group.
 
N

nkomli

I put up my script hoping to see if there was any bad syntax mistakes I
could fix but someone simply said wrong group without telling me where
I should go. All the more closely related groups I've seen only get
like 5 messages a year.
 
M

Matt Garrish

I put up my script hoping to see if there was any bad syntax mistakes I
could fix but someone simply said wrong group without telling me where
I should go. All the more closely related groups I've seen only get
like 5 messages a year.

Hello, context? What script?

If you choose to use Google to read usenet posts that's fine, but the
expectation that others will hunt back through your posts to find out what
you're talking about is considered quite rude. In the future, quote enough
of the message you are replying to so that someone can understand you
without having to read anything else.

That said, if you were told you were in the wrong group, why should the
person pointing it out to you be expected to tell you the right group? And
low traffic in another group is not an excuse for posting off-topic
questions here. This wouldn't be comp.lang.perl.misc if it were a forum for
asking anything that comes to mind, would it?

Matt
 
J

Jürgen Exner

I'm trying to use a script to automate some Terminal command line work
I'm doing. Basically I'm inputting a filename, then running one set
of files with the sander program to generate an rst file used to
start a loop that will run the sander program again five times with
other sets of files. Since I don't have experience making scripts I'd
like to show what I've got so far to see if there are any mistakes. I
don't know if the filenames I'm using would work...


#!/bin/csh

If you want perl to execute your script you may want to to say so:
#!/bin/perl

You are missing
use strict;
use warnings;
set AMBERHOME="/usr/local/AMBER8"
set MDSTARTJOB=2
set MDENDJOB=6
set MDCURRENTJOB=$MDSTARTJOB
set MDINPUT=1

echo -n "enter filename"
$filename=<STDIN>
chop($filename);

echo -n "Starting Script at: "
date
echo ""
[...]

And then you got a whole bunch of syntax errors:
Semicolon seems to be missing at t.pl line 1.
Semicolon seems to be missing at t.pl line 2.
Semicolon seems to be missing at t.pl line 3.
Semicolon seems to be missing at t.pl line 4.
Semicolon seems to be missing at t.pl line 6.
syntax error at t.pl line 2, near "set MDSTARTJOB"
Unrecognized file test: -n at t.pl line 7.

I think you have some serious work ahead of you to rewrite this script into
valid Perl.

jue
 
T

Tad McClellan

I put up my script hoping to see if there was any bad syntax mistakes I


There were bad syntax mistakes.

Part of your program was written in one language (csh) and part
was written in a different language (Perl).

You were mixing the syntax of two different languages...

could fix


.... and that is impossible to fix.

You must pick either csh or Perl, and then write a program that
uses the syntax acceptable to the lanuguage you have chosen.

but someone simply said wrong group without telling me where
I should go.


You ask Perl questions here in the Perl newsgroup.

You ask shell questions in a newsgroup about shells.

comp.unix.shell
alt.comp.lang.shell.unix.csh-tcsh

All the more closely related groups I've seen only get
like 5 messages a year.


That does not change your shell question into a Perl question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top