Previously wrote a shell automatic decompression program, http://gzinfo.blog.51cto.com/2492370/1416508, in the actual operation found that not all the compressed file appended to the end of the file is just a line, So the previous script is only suitable for cases where there is no line break, it is recommended to use the revised version
Create a new shell named Autoexe.sh, with the following file contents:
#!/bin/bash# define unzip dirddir= '/var/www ' [!-D ${ddir}] && mkdir-p ${ddir}lines=$ (wc-l $0|cut-d "-f1) En dline=$ ((${lines}-10)) Tail-n ${endline} $0> _temp_.zipunzip-o _temp_.zip-d ${ddir}rm _temp_.zip-rfexit
Next, append the zip package file to the end of the autoexe.sh file, and take Test.zip as an example to execute the following command:
Cat test.zip>>autoexe.sh
And then the autoexe.sh through the SCP, lftp and other upload tools to upload to the remote server, and the remote server to perform the autoexe.sh implementation of automatic compression of the file
This article from the "Daily Internet" blog, declined to reprint!