Skip to content

Instantly share code, notes, and snippets.

@bmaland
Created November 18, 2010 17:00
Show Gist options
  • Select an option

  • Save bmaland/705278 to your computer and use it in GitHub Desktop.

Select an option

Save bmaland/705278 to your computer and use it in GitHub Desktop.
# Extract & Delete
ed() {
case ${1##*.} in
tar)
tar -xvf $1
;;
tgz|gz|Z)
tar -zxvf $1
;;
tbz|tbz2|bz2)
tar -jxvf $1
;;
zip)
unzip $1
;;
rar)
unrar x $1
;;
7z)
p7zip -d $1
;;
*)
return 1
;;
esac || return 1 # return if extraction failed
rm $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment