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

Recommended Answers

All 2 Replies

naturally there are elements missing due to irrelevency

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.