Skip to content

Instantly share code, notes, and snippets.

@AdamGagorik
Last active October 6, 2023 12:57
Show Gist options
  • Save AdamGagorik/9804677971a45052024ac954df111246 to your computer and use it in GitHub Desktop.
Save AdamGagorik/9804677971a45052024ac954df111246 to your computer and use it in GitHub Desktop.
#!/bin/bash
function usage() {
echo "usage: $0 <dir>"
}
if [[ $# -ne 1 ]] || [[ -z $1 ]]; then
usage
exit -1
fi
DIR=${1%%.tar*}
TAR=${DIR}.tar.gz
if [[ ! -f $TAR ]]; then
usage
echo "not a file: $TAR"
exit -1
fi
echo "Extracting $TAR"
echo " into $DIR"
mkdir $DIR
tar --force-local --directory $DIR -xvf $TAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment