Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Scripts are not working after FTP from windows

    We are using RedHat Advanced Server 3 in order to run batch jobs.

    We are used to edit our scripts using Editors in our Personnal PC (windows xp) and copy them to the linux using FTP.

    The problem is that after copying the scripts (CSH scripts) they are not running unless we are creating new empty file and copy paste the content of them from the original file.

    Our Linux administrator did not succeed to solve this problem.

    In previous versions of the Linux we have no such problem - The scripts are working just fine after FTP from windows

    Any idea how to solve the problem ?

    Thanks in advanced,

  2. #2
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    The Netherlands
    Well this is a problem of the Filesystem of the File and/or how the FTP is setup.
    Give both those settings and I might be able to help you out. (eg do you send bin or ascii and save as unicode or as... that kinda stuff)
    New Users, please read this..
    Google first, then ask..

  3. #3
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    the hills
    Files created or edited on Windows will have a carriage return
    and line feed (CR/LF) at the end of each line of text.
    Files created on UNIX/Linux will have only the line feed, also
    known as newline character. The shell is probably choking
    on the CR/LF

    You should be able to convert the files with the dos2unix
    command. dos2unix <filename>.

    If you don't have dos2unix, look for fromdos

  4. $spacer_open
  5. #4
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Quote Originally Posted by rcgreen
    If you don't have dos2unix, look for fromdos
    Or use awk to fix it:
    awk '{ sub("\r$", ""); print; }' script_here > script_fixed_here

    Make sure the ftp clients are doing ascii transfers, and the operation should remove the carriage returns for you. (Binary transfers won't.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts