script advice
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > script advice




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    script advice  
nkomli@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-14-06 10:54 PM

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"






[ Post a follow-up to this message ]



    Re: script advice  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-15-06 08:03 AM

In article <1139954241.471793.228800@g43g2000cwa.googlegroups.com>,
nkomli@gmail.com wrote:

> 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

It's really not recommended to use csh for scripting.  See

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

> set AMBERHOME="/usr/local/AMBER8"

In csh you have to have spaces around the '=', i.e.

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);

These last two lines are perl, not csh!  The csh syntax is:

set 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"

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:54 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register