零零碎碎写的shell脚本(三):一键自动归档压缩脚本

复制代码
#!/bin/bash
# author by sysk


read -p "There files: " FILE1 FILE2 FILE3
read -p "Destination:" DEST
read -p "Compress[gzip|bzip2|xz]" COMP

case $COMP in
  gzip)
        tar -zcf ${DEST}.tar.gz $FILE1 $FILE2 $FILE3
        ;;
  bzip2)
        tar -jcf ${DEST}.tar.bz2 $FILE1 $FILE2 $FILE3
        ;;
  xz)
        tar -cf ${DEST}.tar $FILE1 $FILE2 $FILE3
        xz ${DEST}.tar
        ;;
  *)
        echo "Unknown"
        exit 9
        ;;
esac
复制代码

 

posted @   夨忆′  阅读(260)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示