Created
February 21, 2024 00:08
-
-
Save shmerl/a42fb90fbf2d5958126d9c5b6a503c2b to your computer and use it in GitHub Desktop.
For convenient extraction of zstd archives
This file contains 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
#!/bin/bash | |
source="$1" | |
if [[ "$source" == "" ]]; then | |
echo "Error: No source provided!" | |
exit 1 | |
fi | |
if ! [[ -e "$source" ]]; then | |
echo "Error: ${source} doesn't exist!" | |
exit 2 | |
fi | |
if [[ "$source" == *.tar.zst ]]; then | |
tar --extract --verbose --use-compress-program "zstd --threads=$(nproc) --decompress --verbose" --file "$source" | |
else | |
zstd --threads=$(nproc) --decompress --verbose "$source" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment