Created
March 20, 2013 01:08
-
-
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.
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 | |
# 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