mirror of https://github.com/rwxrob/dot
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
653 B
Bash
25 lines
653 B
Bash
#!/usr/bin/env bash
|
|
|
|
ex () {
|
|
file=$1
|
|
[ -z "$file" ] && echo 'ex <compressed>' && return 1
|
|
[ ! -f "$file" ] && echo 'Invalid file: `'$file'`' && return 1
|
|
case $file in
|
|
*.tar.bz2) tar xjf $file;;
|
|
*.tar.gz) tar xzf $file;;
|
|
*.bz2) bunzip2 $file;;
|
|
*.rar) unrar x $file;;
|
|
*.gz) gunzip $file;;
|
|
*.tar) tar xf $file;;
|
|
*.tbz2) tar xjf $file;;
|
|
*.tgz) tar xzf $file;;
|
|
*.zip) unzip $file;;
|
|
*.Z) uncompress $file;;
|
|
*.7z) 7z x $file;;
|
|
*.xz) unxz $file;;
|
|
*) echo 'Unknown suffix on file: `'$file'`'; return 1 ;;
|
|
esac
|
|
}
|
|
|
|
ex "$@"
|