0

Hi,

I've never used bash before, but am creating a file. Here's the skelton:

while read line; do 

    if [ -e "$line" ]
    then

    else

        cat > $name << EOF

        EOF

        cat > rails << EOF

        EOF

    fi
    command $name &
done < projects.txt

The error is: "line 55: syntax error: unexpected end of file", where naturally line 55 is that last line.

Are the two last lines correct? I'm from a php, ruby background, and should while and do have to do ending 'tags' as such??

Thanks

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Watael
0

hi,

why use cat with EOF, can't you use echo or printf?

the last EOF has to be on the first column.

anyCommand <<EOF
   blah
      blah
EOF

the code tag doesn't make things obvious ;)

you could use tabulation by prefixing the first EOF with a dash

anyCommand <<-EOF
   blah
      blah
<there should be a tab>EOF

but some editors change tabulation to spaces.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.