Results 1 to 2 of 2

Thread: [SOLVED] SH TAR Script nonprintable characters in filenames.

  1. #1
    Join Date
    Oct 2008
    Location
    Ancaster, Ontario, Canada
    Beans
    26
    Distro
    Ubuntu

    Arrow [SOLVED] SH TAR Script nonprintable characters in filenames.

    Preface: Yeah - I'm a week-old-newb and I am missing something obvious.

    My weekly tar backup script is (finally) running successfully, but the output filename (generated by variables in the script) has non-standard characters.

    Line breaks (Nautilus) and Question marks (term) are showing up in the filing listing. I have been trying different combination of brackets/quotes to fix this. Any help from some scripting gurus is appreciated.

    Script:
    #!/bin/sh
    COMPUTER=backup
    NOW=`date +%F-%H%M`
    tar cpj --checkpoint=.100 -f "/mnt/backup/${COMPUTER}-${NOW}F.tar.bz2" -X "/home/name/Documents/xfiles1.txt" -C / *

    ls -l Output:
    -rw-r--r-- 1 root root 771K 2008-10-03 12:03 backup?-2008-10-03-1203?F.tar.bz2

    Many thanks in advance, and probably after as well! My wall has a big indent about the size and shape of my head from this.
    Last edited by ashton88; October 3rd, 2008 at 07:02 PM. Reason: Solved

  2. #2
    Join Date
    Oct 2008
    Location
    Ancaster, Ontario, Canada
    Beans
    26
    Distro
    Ubuntu

    Re: SH TAR Script nonprintable characters in filenames.

    Ahhh... I figured it out myself when I bumped into another problem.

    I initially wrote the script in notepad, and I didn't realize (read: newb) that there was a difference between notepad TEXT and Gedit TEXT.

    So if anyone runs into this problem down the line, install dos2unix by running:

    apt-get install tofrodos

    And then convert your script to UNIX format by running:

    dos2unix <scriptname>

    Cheers.

Tags for this Thread

Bookmarks

Posting Permissions

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