From d8f9a4c9722707436886b017c5a31d97a70405af Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Sat, 5 Jul 2014 03:02:44 +0200 Subject: [PATCH] Updated extract script --- bash_profile | 6 +++++- zshrc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bash_profile b/bash_profile index 00d7332..54ecea6 100644 --- a/bash_profile +++ b/bash_profile @@ -39,7 +39,11 @@ extract(){ *.tar) tar xf $1 ;; *.tbz2) tar xjf $1 ;; *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; + *.zip) if [ -n $2 ] ; then + unzip $1 -d $2 + else + unzip $1 + fi ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted via extract()" ;; diff --git a/zshrc b/zshrc index e8b679c..78f8e78 100644 --- a/zshrc +++ b/zshrc @@ -73,7 +73,11 @@ extract(){ *.tar) tar xf $1 ;; *.tbz2) tar xjf $1 ;; *.tgz) tar xzf $1 ;; - *.zip) unzip $1 ;; + *.zip) if [ -n $2 ] ; then + unzip $1 -d $2 + else + unzip $1 + fi;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted via extract()" ;;