压缩保留源文件:gzip –c filename > filename.gz
打包压缩不带路径: tar -zcfP filename.tar.gz filename(解压也要带-P)
shell命令
file=/home/test/class/1.log
no_file_path=${file%/*} ###no_file_path=/home/test/class
city=${no_file_path##*/} ### city=class