Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added a function to extract various archives.

Also an alias for the function.
  • Loading branch information...
commit ff0b25b745494d96ae06694321b2299991620b14 1 parent 4fadc30
Bjarki Ágúst Guðmundsson authored
2  lib/aliases.zsh
@@ -21,3 +21,5 @@ alias ll='ls -l'
21 21
 alias sl=ls # often screw this up
22 22
 
23 23
 alias afind='ack-grep -il'
  24
+
  25
+alias x=extract
21  lib/functions.zsh
@@ -37,3 +37,24 @@ function take() {
37 37
   mkdir -p $1
38 38
   cd $1
39 39
 }
  40
+
  41
+function extract() {
  42
+  if [[ -f $1 ]]; then
  43
+    case $1 in
  44
+      *.tar.bz2) tar xvjf $1;;
  45
+      *.tar.gz) tar xvzf $1;;
  46
+      *.bz2) bunzip $1;;
  47
+      *.rar) unrar $1;;
  48
+      *.gz) gunzip $1;;
  49
+      *.tar) tar xvf $1;;
  50
+      *.tbz2) tar xvjf $1;;
  51
+      *.tgz) tar xvzf $1;;
  52
+      *.zip) unzip $1;;
  53
+      *.Z) uncompress $1;;
  54
+      *.7z) 7z x $1;;
  55
+      *) echo "'$1' cannot be extracted via >extract<";;
  56
+    esac
  57
+  else
  58
+    echo "'$1' is not a valid file"
  59
+  fi
  60
+}

0 notes on commit ff0b25b

Please sign in to comment.
Something went wrong with that request. Please try again.