Bash help needed

Discussion in 'Programming/Scripts' started by TheMuse, Nov 22, 2006.

  1. TheMuse

    TheMuse New Member

    I am a novice running a Linux script with the following code:

    echo ${RUN_HOME_DIR}
    mkdir ${RUN_HOME_DIR}
    mkdir ${RUN_TMP_DIR}
    echo "Run Home Directory: $RUN_HOME_DIR"
    cp ${RUN_HOME_DIR}/out1_junk/*.out ${RUN_TMP_DIR}/*.1

    The output I get is the following:

    mkdir: cannot create directory `/home/Microps/test123\r\r\r'
    mkdir: cannot create directory `/tmp/test123\r\r\r'
    Run Home Directory: /home/Microps/test123
    cp: cannot stat `/home/Microps/test123\r\r/out1_junk/*.out': No such file or
    I was wondering if you had any ideas about how to get rid of the
    that is being appended at the end or the variable names.
    When I do list the directory using
    it show the directories are created as

    The code :
    echo "Run Home Directory: $RUN_HOME_DIR"
    echo "Run Temp Directory: $RUN_TMP_DIR"

    Gives me an output as follows:
    Run Home Directory: /home/binoy/Microps/test123
    Run Temp Directory: /tmp/binoy/test123
    There are some hidden characters that are added to my strings which do not show up using the echo command, but show as question marks when i list the directories. How do I ensure that this does not happen?
    It seems to be some kind of a delimiting or "naked" escape character problem, but I am not able to identify it. Any ideas will be greatly appreciated!
  2. Ben

    Ben ISPConfig Developer ISPConfig Developer

    I would try deleting that line with test123, rewrite it and set it into " instead of '
  3. falko

    falko Super Moderator ISPConfig Developer

    Also make sure you save that script with Unix linebreaks!
  4. TheMuse

    TheMuse New Member


    Thanks Falko!
    It seems like it was using DOS linebreaks even though I had created the file using vi editor!
  5. drks

    drks New Member HowtoForge Supporter

    If you or anyone has issues like this you can also use the dos2unix command to fix similar issues... generally when files are created on a windows box and uploaded to a linux box.

Share This Page