PDA

View Full Version : Line 13: Syntax error: Unexpected end of file


myoung
April 3rd, 2009, 20:30
I keep receiving the following error message when trying to use this script in Cygwin. When use this same script within a Linux box the script works fine? Can anyone assist with this issue?


#!/bin/bash
cat file2.txt |while read line; do
echo ${line}
smbclient //${line}/c$ -W domain -U user%"password" << "EOF"
cd "/Documents and Settings"



ls

done
EOF

LateNiteTV
April 4th, 2009, 00:46
why do you have EOF?

MG
April 4th, 2009, 10:47
What are you trying to do? A script that creates another script?

#!/bin/bash

(
cat << EOF
#!/bin/sh
echo "test"
EOF
) > filename.txt

for EOF you can use any text.

SirDice
April 6th, 2009, 11:27
why do you have EOF?

It's called a HERE document:
http://en.wikipedia.org/wiki/Heredoc

SeanC
April 13th, 2009, 23:46
I keep receiving the following error message when trying to use this script in Cygwin. When use this same script within a Linux box the script works fine? Can anyone assist with this issue?


cd "/Documents and Settings"




Not my area of expertise, but this looks odd. Shouldn't the quotes come after the forward-slash?

cd /"Documents and Settings"

ale
April 13th, 2009, 23:52
Not my area of expertise, but this looks odd. Shouldn't the quotes come after the forward-slash?

cd /"Documents and Settings"

From what I can remember, on cygwin it should be something like "/cygdrive/c/Documents and Settings".
The dos unit C: should be /cygdrive/c

SeanC
April 14th, 2009, 15:33
That's what I was thinking. The whitespace probably needs to be handled correctly.