参考:https://jingyan.baidu.com/article/851fbc371d8c907e1e15ab79.html
- 加密
#!/bin/bash
ori=$(pwd)
cd $(dirname $1)
if [ $2 ]; then
tar -zcf - $(basename $1) | openssl aes256 -salt -md sha256 > $ori/$2
else
echo Must specify the name of output file
fi
- 解密
#!/bin/bash
if [ $2 ]; then
cat $1 | openssl aes256 -md sha256 -d | tar zx -C $2
else
cat $1 | openssl aes256 -md sha256 -d | tar zx
fi