Created
May 27, 2025 06:52
-
-
Save kennycyb/4997fd79a9a9f2f418c22e6c3c887dfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # decrypt gpg and untar to the basename | |
| tgx() { | |
| if [[ $# -ne 1 ]]; then | |
| echo "Usage: tgx <file.tar.gz.gpg>" | |
| return 1 | |
| fi | |
| local input_file="$1" | |
| local base_name="${input_file%.tar.gz.gpg}" | |
| local output_dir="${base_name}" | |
| mkdir -p "$output_dir" || { | |
| echo "Failed to create output directory: $output_dir" | |
| return 1 | |
| } | |
| echo "Decrypting and extracting $input_file to $output_dir/" | |
| gpg -d "$input_file" | tar -xz -C "$output_dir" || { | |
| echo "Decryption or extraction failed." | |
| return 1 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment