kristo5747
Programmer
Hello,
I have a script that "validates" a ZIP file that look like this
My task is to compare its contents (i.e the list of files contained inside) with the control file that is provided inside the ZIP file itself.
Since we've started receiving files with spaces in their name, I prevented the OS from word splitting file names when I view the ZIP's contents like so
When I try to do the same with the control file,
SECOND_Array() ends up empty and my array comparison (diff -q) fails.
This is very bizarre since my control file has three records:
How can prevent word splitting when I view the contents of the control file? Any ideas?
Thank you.
I have a script that "validates" a ZIP file that look like this
Code:
AAA_20120801.zip =>
x~back end~20120801.TXT
y~time in~20120801.TXT
z~heat_chamber~20120801.TXT
AAA_20120801.ctl
Since we've started receiving files with spaces in their name, I prevented the OS from word splitting file names when I view the ZIP's contents like so
Code:
FIRST_Array=(); while read length date time filename; do FIRST_Array+=( "$filename" ); echo -e "$filename";
done < <(/usr/bin/unzip -qql AAA_20120801.zip)
Code:
SECOND_Array=(); while read length date time filename; do SECOND_Array+=( "$filename" ); echo -e "$filename"; done < <(/usr/bin/unzip -c AAA_20120801.zip AAA_20120801.ctl )
This is very bizarre since my control file has three records:
Code:
x~back end~20120801.TXT
y~time in~20120801.TXT
z~heat_chamber~20120801.TXT
How can prevent word splitting when I view the contents of the control file? Any ideas?
Thank you.