Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
while read file1; do
     while read file2 : do
    if [ $file1 == $file2 ] ; then
    $file1 >> /infanass/dev/admin/test/newlist.txt
    echo "$file1"
    echo "$file2"
 done < /infanass/dev/admin/test/file2.txt
done < /infanass/dev/admin/test/file1.txt

Error :

 ./test.bsh: line 9: syntax error near unexpected token `done'
 ./test.bsh: line 9: `    done 3</infanass/dev/admin/test/file2.txt'
share|improve this question

closed as off-topic by terdon, jasonwryan, slm, Anthon, Gilles Jul 16 '13 at 22:41

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

This question appears to be off-topic because it is too localized since the only error was a simple typo and in any case, this is not a *nix question but a bash one. – terdon Jul 16 '13 at 17:46

On line 3 you have

while read file2 : do

It should read

while read file2 ; do

So your while loop's syntax would be valid.

And on a sidenote: since you are using the older [ and not [[ you should quote the file1 and file2 variables to prevent pathname expansion and word splitting from breaking your [ command.

share|improve this answer
I am stupid! wow – mkrouse Jul 16 '13 at 17:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.