
Perl and tar not cooperating in a shell script
I've been having problems with my (homemade) backup system.
Occasionally, tar is asked to back up file with spaces or other odd
characters in their names. These files are _always_ lost in the
backup. What I would like to do, is to encapsulate each filename within
quotes. I.e., tar file1 file2 file number 3
Would become: tar "file1" "file2" "file number 3" etc..
My backup currently does the following (basically):
1. use "find" to grab all the files needed to be backed up and dump the
results into a temporary file.
2. use "tar cf $backup_device `cat $temporary_file`" to backup the
files.
I would like to modify step 2:
2. use "tar cf $backup_device `cat $temporary_file |
quo{*filter*}capsulate.pl`" to backup the files.
I have been using the following as 'quo{*filter*}capsulate.pl':
#!/usr/bin/perl -w
$line =~ s/\n//;
print STDOUT "'$line' ";
Quote:
}
**THE PROBLEM**
tar _ALWAYS_ reports that it cannot find the files output by
quo{*filter*}capsulate.pl. I think that it is possible that the (') character
returned by the perl script may be of a different code value than that
expected by tar. I have also tried (\") in place of (') in the above
code snippet. Neither seem to work.
**MY QUESTION**
Should I be using a hex code in the above code snippet in place of (')
or (")? Can anybody else get this system to work?
Matt