Skip to content

Instantly share code, notes, and snippets.

@Kubuxu
Created November 16, 2018 10:09
Show Gist options
  • Save Kubuxu/6d0f6c42a4d0b28514fe98624712cba4 to your computer and use it in GitHub Desktop.
Save Kubuxu/6d0f6c42a4d0b28514fe98624712cba4 to your computer and use it in GitHub Desktop.
#!/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