Skip to content

Instantly share code, notes, and snippets.

View buzztaiki's full-sized avatar

Taiki Sugawara buzztaiki

View GitHub Profile
@buzztaiki
buzztaiki / tarx.bash
Created February 14, 2012 06:17 — forked from sasagon/tarx.sh
中身が単一ディレクトリになってないアーカイブを展開するときに、適当なディレクトリを作ってからその中に展開するshell script
#!/bin/bash --
for F in $@ ; do
if [ $(tar tf $F | grep -o '^[^/]*/' | sort | uniq | wc -l) -eq 1 ]; then
tar xvf $F
else
D=$F
for x in .tgz .tbz .txz .tar.gz .tar.bz2 .tar.xz; do
D=$(basename "$D" $x)
done