all repos

dotfiles @ 0f397441e346720f113916b8210d321da66f2339

i use rach linux btw

dotfiles/bin/ex (view raw)

1
#!/usr/bin/env bash
2
3
ex() {
4
  file=$1
5
  [ -z "$file" ] && echo 'ex <compressed>' && return 1
6
  [ ! -f "$file" ] && echo 'Invalid file: `'"$file"'`' && return 1
7
  case "$file" in
8
  *.tar.bz2) tar xjf "$file" ;;
9
  *.tar.gz) tar xzf "$file" ;;
10
  *.bz2) bunzip2 "$file" ;;
11
  *.rar) unrar x "$file" ;;
12
  *.gz) gunzip "$file" ;;
13
  *.tar) tar xf "$file" ;;
14
  *.tbz2) tar xjf "$file" ;;
15
  *.tgz) tar xzf "$file" ;;
16
  *.zip) unzip "$file" ;;
17
  *.Z) uncompress "$file" ;;
18
  *.7z) 7z x "$file" ;;
19
  *.xz) unxz "$file" ;;
20
  *)
21
    echo 'Unknown suffix on file: `'"$file"'`'
22
    return 1
23
    ;;
24
  esac
25
}
26
27
ex "$@"