Cat adds a script to the start of a .gz file that extracts the .gz file.
I made a GUI to make the self-extracting files, but I keep getting errors.
The "tail" line pipes the rest of the file below "### END" to gunzip.
Error is: gunzip: unexpected end of file.
Code: Select all
#!/bin/sh
lastLINE=`cat $0 |grep -n '### END' |tail -n 1 |sed 's/:.*$//'`
stLINE=`expr $lastLINE + 1`
tail -n +$stLINE $0 |gunzip
exit 0
### END