Re: [AMBER] Script error in Umbrella tutorial

From: Jason Swails <jason.swails.gmail.com>
Date: Sun, 3 Aug 2014 16:03:34 -0400

On Sun, Aug 3, 2014 at 2:56 PM, Kshatresh Dutta Dubey <kshatresh.gmail.com>
wrote:

> Dear Users,
>
> Sorry for asking a question which may not be appropriate for amber
> archive. I am following the amber advance tutorial 17 for umbrella
> sampling. When I am using the script :
> #!/bin/csh
> foreach i ( *.dat )
> echo $i
> cat $i >> all_dihedrals.dat
> end
>
> It is showing error as
> script-all-dihed: line 2: syntax error near unexpected token `('
> script-all-dihed: line 2: `foreach i ( *.dat )'


> Please help me to solve this issue, I have no much knowledge of shell
> scripting.
>

​It is an important skill to learn for people that perform calculations as
a regular part of their studies. In order for us to tell you what went
wrong, though, you need to tell us exactly what you did.

The shell script here is written in C-shell (the shebang line, starting
with #!, indicates that this script is intended to be run with /bin/csh).
 The default shell most people use -- bash -- has a completely different
syntax compared to C-shell.​ What Asaminew sent you was the same script
written in bash. The fact that his script worked meant that however you
were executing the script (maybe "bash <script>" or "sh <script>") was
forcibly invoking the bash shell rather than the correct shell (C-shell).

Shell scripting is useful for many purposes -- it helps automate tasks so
large numbers of tasks can be carried out very rapidly while reducing the
chance for mistakes. And if you find a mistake, you can fix it and re-run
the tasks you need re-run instantly. It also serves as a record of
_exactly_ what you've done, preserving all of the details.

I suggest picking a shell (probably 'bash' since that's what you seem to be
using), and start scripting your various tasks, consulting Google when you
don't know how to do something.

Good luck,
Jason

-- 
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sun Aug 03 2014 - 13:30:03 PDT
Custom Search