Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
#!/bin/bash
while read file1; do
     while read file2 : do
    if [ $file1 == $file2 ] ; then
    $file1 >> /infanass/dev/admin/test/newlist.txt
    fi
    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.

4  
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
add comment

1 Answer 1

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
add comment

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