Skip to content

Instantly share code, notes, and snippets.

@thoward
Created March 20, 2013 01:08
Show Gist options
  • Save thoward/5201546 to your computer and use it in GitHub Desktop.
Save thoward/5201546 to your computer and use it in GitHub Desktop.
Simple untar script that does the obvious thing and creates a directory named after the tar file, then extracts a tar in that directory. This is a handy to install in user scope to augment tar.
#/bin/bash
# cross platform absolute path function
abspath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
outd=`abspath ``basename $1 .tgz```
target=`abspath $1`
echo "extracting to $outd"
(mkdir -p $outd && cd $outd && tar -zxvf $target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment