ftp problem

Hello,

I have a very simple script that put a file in server ftp

#!/bin/bash
var="ITW-trail-templiers-samedi"
cd /Users/$USER/Desktop
ftp -n >&1 << EOF
open server
quote user "user"
cd oberon
binary
put "$var"
bye
EOF

I have error :

200 Type set to IMAGE.
 remote: ITW-trail-templiers-samedi
ftp: Can't open `ITW-trail-templiers-samedi\r': No such file or directory
221 Goodbye

I don't understand ??? If i write the name of the file, not $var....it's works fine ????

---------- Post updated at 02:53 AM ---------- Previous update was at 02:40 AM ----------

I find my error, my file must be an argument of my script

Thanx

Writing ftp scripts in Bash isn't fun. I strongly suggest that Perl and the Net::FTP module make this much, much easier. It's not hard - I have some examples at Perl Net::FTP

@TonyLawrence

I have visited your site before. However I missed this great page. I will find these scripts a wonderful home in our production environment.

Thanks,

Abacus