#!/bin/bash
Type=$1
Password=$2
Folder1=$3
File1=$4
if [ ! -n "$1" ] ;then
echo "tarmm jiami password Folder file.tar.gz"
echo "tarmm jiemi password file.tar.gz"
exit 0
fi
if [ ! -n "$2" ] ;then
echo "tarmm jiami password Folder file.tar.gz"
echo "tarmm jiemi password file.tar.gz"
exit 0
fi
if [ ! -n "$3" ] ;then
echo "tarmm jiami password Folder file.tar.gz"
echo "tarmm jiemi password file.tar.gz"
exit 0
fi
case "$1" in
jiami)
if [ ! -n "$4" ] ;then
echo "tarmm jiami password Folder file.tar.gz"
echo "tarmm jiemi password file.tar.gz"
exit 0
fi
tar czvf - $Folder1 | openssl des3 -salt -k $Password -out $File1
;;
jiemi)
File1=$3
openssl des3 -d -k $Password -salt -in $File1 | tar zxvf -
;;
*)
echo "tarmm jiami password Folder file.tar.gz"
echo "tarmm jiemi password file.tar.gz"
exit 3
;;
esac