-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecrypt.sh
More file actions
executable file
·38 lines (28 loc) · 797 Bytes
/
decrypt.sh
File metadata and controls
executable file
·38 lines (28 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Déchiffre chaque fichier fourni en argument
# Le déchiffrage est asymétrique et cherche parmi les clés privées gpg disponibles
tar_cmd=xvz
################ Example found in /usr/share/doc/util-linux/examples/getopt-parse.bash
TEMP=`getopt -o l --long list -n "$0" -- "$@"`
if [ $? != 0 ] ; then echo "Abandon" >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-l|--list)
tar_cmd=tz
shift ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
################ End example ##########################################################
if (( $# == 0 ))
then
gpg --decrypt | tar $tar_cmd
else
for f in $*
do
gpg --decrypt $f | tar $tar_cmd
done
fi