cat $1 printf "X" cat $0 exit
cat $1 printf "X" cat $0 exit
1. Copy the part of the file preceding that substring to a file named "foo".
2. Take the rest of the file, including all of the substring EXCEPT for the initial X character, and put it in an executable file called "decompressor".
When you run "./decompressor foo > out", you will then recreate the original file. The length of decompressor + foo will be one byte shorter than the original file.
If I split it into two files, $1 and $2 that look like this: $1 - AAAAAAAA $2 - AAAAAAA
I have now "saved" one byte by dropping the X.
The script "cat $1 printf "X" cat $0 exit" will combine those two files and reinsert the X, thus "decompressing" the data. Basically, he has replaced the byte "X", which counted towards the total size, with the EOF marker on the filesystem, which technically didn't count.
No space was actually saved, because he basically moved the information from the X character to metadata (the file splits).
That's where I'm getting confused.
return(join("X", files 1 to 136))
Since the script takes up fewer bytes than the 136 "X" bytes would, the total size of the 136 files + decompressor script is less than the size of the original file.