summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Ramael <robin.ramael@gmail.com>2011-01-10 17:34:38 +0100
committerSuprDewd <suprdewd@gmail.com>2011-01-10 17:49:53 +0000
commitbcc235e1420f39a0dbd8a7672dffc0f0c81e9b53 (patch)
tree1acbcaaad1e25683fd6ecc465d49726a12831e62
parentf0136f2aec4efdd11e976ddbbfd204ca5e113498 (diff)
downloadzsh-bcc235e1420f39a0dbd8a7672dffc0f0c81e9b53.tar.gz
zsh-bcc235e1420f39a0dbd8a7672dffc0f0c81e9b53.tar.bz2
zsh-bcc235e1420f39a0dbd8a7672dffc0f0c81e9b53.zip
Added an option to remove file afterwards.
-rw-r--r--lib/functions.zsh13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 4246f8811..914f2ef25 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -39,6 +39,12 @@ function take() {
}
function extract() {
+ unset REMOVE_ARCHIVE
+
+ if test "$1" = "-r"; then
+ REMOVE=1
+ shift
+ fi
if [[ -f $1 ]]; then
case $1 in
*.tar.bz2) tar xvjf $1;;
@@ -56,7 +62,14 @@ function extract() {
*.7z) 7z x $1;;
*) echo "'$1' cannot be extracted via >extract<";;
esac
+
+ if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
+ echo removing "$1";
+ /bin/rm "$1";
+ fi
+
else
echo "'$1' is not a valid file"
fi
}
+