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.
1#/bin/bash
2
3# cross platform absolute path function
4abspath() {
5 [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
6}
7
8outd=`abspath ``basename $1 .tgz`` `
9target=`abspath $1`
10
11echo "extracting to $outd"
12(mkdir -p $outd && cd $outd && tar -zxvf $target)
This is available as a Gist here: https://gist.github.com/thoward/5201546