File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,30 @@ function mkdir.mp3() {
117117}
118118```
119119
120+ ## Encrypt/decrypt tar archives
121+
122+ ```
123+ function tar.encrypt() {
124+ # $1...: files or folders to encrypt
125+ if [ "$#" == 0 ]; then
126+ echo Usage: encrypt \<file\> [\<file\> ...]
127+ return 1
128+ else
129+ tar czvpf - "$@" | gpg --symmetric --cipher-algo aes256 -o archive.tar.gz.gpg
130+ fi
131+ }
132+
133+ function tar.decrypt() {
134+ # $1: archive to decrypt
135+ if [ "$#" != 1 ]; then
136+ echo Usage: decrypt \<archive\>
137+ return 1
138+ else
139+ gpg -d $1 | tar xzvf -
140+ fi
141+ }
142+ ```
143+
120144## Appendix: Bash programming reference
121145
122146< https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html >
You can’t perform that action at this time.
0 commit comments