dots

Personal dotfiles
git clone git://git.gormless.xyz/dots.git
Log | Files | Refs

extract (451B)


      1 #!/bin/sh
      2 
      3 if [ -f "$1" ] ; then
      4 	case "$(file -ib "$1" | cut -d';' -f1 | cut -d'/' -f2)" in
      5 		bzip2|x-bzip2)	tar xjvf "$1"      ;;
      6 		gzip|x-gzip)	tar xzvf "$1"      ;;
      7 		x-rar)			unrar x "$1"       ;;
      8 		tar|x-tar)		tar xf "$1"        ;;
      9 		zip)				unzip "$1"         ;;
     10 		x-7z-compressed)	7z x "$1"       ;;
     11 		x-zip-compressed|x-xz)	unxz "$1" ;;
     12 		*)					echo "'$1' cannot be extracted via extract()" ;;
     13 	esac
     14 else
     15 	echo "'$1' is not a valid file"
     16 fi