On 2/24/2011 9:55 AM, Christopher D Haakinson wrote:

I'd like someone to explain how this small shell script, which works fine, gets corrupted simply by creating a new file and copy/pasting the text in it. Here's what I'm doing:

1) I have a test shell script that runs fine. Here's the content:
<------------------------- start
lock="/tmp/deleteme"
if [ -f $lock ]
then
echo "Lock file exists. Wait until it's gone to proceed. ."
while [ -f $lock ]
do
echo "Waiting for lockfile to be removed. ."
sleep 1s
done
echo "Now creating lock file"
echo "locked" > $lock
else
echo "No lock file found. Creating it. ."
echo "locked" > $lock
fi
echo "Lets try this again, hopefully for the last time...."
exit 0
<-------------------------- end

2) I copy this entire script from notepad in windows into a new file named test2.sh, also in notepad.
3) Using TortoiseSVN, I add test2.sh into my project
4) I commit the changes to the server
5) On my linux server, I run: svn update ... to get the test2.sh file
6) Now when I try to run it I get this:
syntax error: unexpected end of file


Now, this is the most simple task I could think of doing, and this doesn't work. I've also tried creating the new shell script with Komodo EDIT with the same results.

This occurs even though I've tried adding svn:eol-style from both my linux server and my windows wrx... I'm lost!!


In Notepad, can you move your cursor below the last line of text in the file? If not, there won't be a newline after the final line. Under Linux, try "od -c test2.sh | more" and verify that there is a "\n" at the very end of the listing. If not, you'll need to add one in Notepad, Komodo, or your favorite Linux editor.

I have no idea why you would see this problem only with "svn:eol-style" defined (if in fact this is the problem).

--
    David Chapman         dcchap...@acm.org
    Chapman Consulting -- San Jose, CA

Reply via email to