script advice

Discussion in 'Perl Misc' started by nkomli@gmail.com, Feb 14, 2006.

  1. Guest

    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"
    , Feb 14, 2006
    #1
    1. Advertising

  2. Brian Wakem Guest

    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



    Wrong group.



    --
    Brian Wakem
    Email: http://homepage.ntlworld.com/b.wakem/myemail.png
    Brian Wakem, Feb 14, 2006
    #2
    1. Advertising

  3. Guest

    which group then?
    , Feb 14, 2006
    #3
  4. Matt Garrish Guest

    <> wrote in message
    news:...
    > which group then?
    >


    What group now? Hello, context?

    Matt
    Matt Garrish, Feb 14, 2006
    #4
  5. Guest

    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.
    , Feb 14, 2006
    #5
  6. Matt Garrish Guest

    <> wrote in message
    news:...
    >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
    Matt Garrish, Feb 14, 2006
    #6
  7. 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


    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
    Jürgen Exner, Feb 15, 2006
    #7
  8. Ian Wilson Guest

    Ian Wilson, Feb 15, 2006
    #8
  9. Ian Wilson Guest

    Ian Wilson, Feb 15, 2006
    #9
  10. John W. Krahn, Feb 15, 2006
    #10
  11. <> wrote:

    > I don't know if
    > the filenames I'm using would work...



    What happened when you tried it?


    > #!/bin/csh



    This is the Perl newsgroup, we discuss Perl here.

    Did you have some question related to Perl?


    [snip shell script]


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Feb 15, 2006
    #11
  12. <> wrote:

    > 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.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Feb 15, 2006
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Asun Friere
    Replies:
    1
    Views:
    492
    Paul Boddie
    Aug 27, 2003
  2. Peter Hansen
    Replies:
    23
    Views:
    863
    Anton Vredegoor
    Sep 5, 2003
  3. Gerrit Holl
    Replies:
    16
    Views:
    613
    Tom Plunket
    Aug 29, 2003
  4. Asun Friere
    Replies:
    0
    Views:
    476
    Asun Friere
    Aug 28, 2003
  5. Michele Simionato
    Replies:
    2
    Views:
    382
    Jacek Generowicz
    Sep 1, 2003
Loading...

Share This Page