?
Solved

Shell coding

Posted on 2011-10-27
3
Medium Priority
?
178 Views
Last Modified: 2012-05-12
Hi,

I'm trying to get a shell script to run. I think I've correctly defined both $database and $antibodydb, but I'm currently receiving the error output:

genomevsantibody.sh: line 4: syntax error near unexpected token `for'
genomevsantibody.sh: line 4: `for antibodydb in $(find ~/DatabaseTesting -name "                                                                                                                                                             *ABDatabase")'

any advice with this would be much appreciated. Thanks.
#!/bin/bash
for database in $(find ~/Genomes -name "*DATABASE")

for antibodydb in $(find ~/DatabaseTesting -name "*ABDatabase")

do
   echo "Processing $database"
   blastall -p blastp -m 8 -d $antibodydb -i $database >> GenomeBlastResults.txt

done

Open in new window

0
Comment
Question by:StephenMcGowan
  • 2
3 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 37040719
First for neither has
do
Nor
done
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37040746
You should have
for ...
do
    code here
done
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 37040747
You missed to open and close the outer "for" loop.
See lines 3 and 8 below.

 
#!/bin/bash
for database in $(find ~/Genomes -name "*DATABASE")
 do
  for antibodydb in $(find ~/DatabaseTesting -name "*ABDatabase")
   do
    echo "Processing $database"
    blastall -p blastp -m 8 -d $antibodydb -i $database >> GenomeBlastResults.txt
   done
 done

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question