I wrote a little shell script (on CentOS) to download statistics from our APC UPS device. It works great, but everyday cron sends an email with this message:

WARNING! 1 bare linefeeds received in ASCII mode File may not have transferred correctly.

I also get that message when I get the file manually on the shell. The FTP part of my script looks like this:

ftp -in $ftpip <<END_FTP_DOWNLOAD
user $ftpuser $ftppassword
get data.txt

How can I get rid of this warning message which may disturb my colleagues?

The manual FTP connection looks like this. I tried to type "ascii" this time:

220 AP9617 Network Management Card AOS v2.6.4 FTP server ready.
Name ( username
331 User name okay, need password.
230 User logged in, proceed.
ftp> ascii
200 TYPE Command okay.
ftp> get data.txt
local: data.txt remote: data.txt
227 Entering Passive Mode (192,168,0,50,161,31).
125 Data connection already open; transfer starting.
WARNING! 1 bare linefeeds received in ASCII mode
File may not have transferred correctly.
226 Closing data connection.
131468 bytes received in 19,3 secs (6,6 Kbytes/sec)
ftp> bye
221 Thank you for using APC products!

The data.txt has between 500 and 800 lines and the last line is always empty.


Try to use binary mode instead of ASCII mode. It should be something like:

ftp -in $ftpip << END_FTP_DOWNLOAD
user $ftpuser $ftppassword
get $filename
  • 1
    this solution works fine and seems more reliable – Labynocle Nov 10 '14 at 17:26

Now i've found a (dirty) solution:

I download the textfile in BINARY mode and then replace the ^M character which gets inserted in the file since it looks like the APC UPS is based on DOS...

tr -d '\015' < data.txt > data-$today.txt

If someone comes up with a better solution it would be great, but this also works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.