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()" ;;