summaryrefslogtreecommitdiff
path: root/etc/functions/extr
blob: 98d3ffe13c3b5406aaf54fa584f13f3a3db7d974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# builtin function for archives, see $ZDIR/alias_suffix
if [[ -f "$1" ]]; then
	case "$1" in
		*.tar.bz2) tar xjvf "$1" ;;
		*.tar.gz) tar xvzf "$1" ;;
		*.ace) unace e "$1" ;;
		*.rar) unrar x "$1" ;;
		*.deb) ar -x "$1" ;;
		*.bz2) bzip2 -d "$1" ;;
		*.lzh) lha x "$1" ;;
		*.gz) gunzip -d "$1" ;;
		*.tar) tar xvf "$1" ;;
		*.tgz) gunzip -d "$1" ;;
		*.tbz2) tar jxvf "$1" ;;
		*.zip) unzip "$1" ;;
		*.Z) uncompress "$1" ;;
		*.shar) sh "$1" ;;
		*) echo "I don't know the archive type of '"$1"' :(" ;;
	esac
else
	echo "Hm. Seems '"$1"' is not a valid file."
fi