Created
November 16, 2018 10:09
-
-
Save Kubuxu/6d0f6c42a4d0b28514fe98624712cba4 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
#!/bin/bash | |
FILE="$1" | |
TYPE="$(file $1)" | |
if ! echo "$TYPE" | grep "compressed data" >/dev/null 2>&1; then | |
echo "Plik $FILE nie jest zkompressowany"; | |
exit 1 | |
fi | |
case "$FILE" in | |
*.zip) | |
unzip "$FILE" | |
;; | |
*.tar | *.tar.gz | *.tar.xz) | |
tar xf "$FILE" | |
;; | |
*) | |
echo "unrecognized format" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment