... | ... |
@@ -39,6 +39,12 @@ function take() { |
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
function extract() { |
42 |
+ unset REMOVE_ARCHIVE |
|
43 |
+ |
|
44 |
+ if test "$1" = "-r"; then |
|
45 |
+ REMOVE=1 |
|
46 |
+ shift |
|
47 |
+ fi |
|
42 | 48 |
if [[ -f $1 ]]; then |
43 | 49 |
case $1 in |
44 | 50 |
*.tar.bz2) tar xvjf $1;; |
... | ... |
@@ -56,7 +62,14 @@ function extract() { |
56 | 56 |
*.7z) 7z x $1;; |
57 | 57 |
*) echo "'$1' cannot be extracted via >extract<";; |
58 | 58 |
esac |
59 |
+ |
|
60 |
+ if [[ $REMOVE_ARCHIVE -eq 1 ]]; then |
|
61 |
+ echo removing "$1"; |
|
62 |
+ /bin/rm "$1"; |
|
63 |
+ fi |
|
64 |
+ |
|
59 | 65 |
else |
60 | 66 |
echo "'$1' is not a valid file" |
61 | 67 |
fi |
62 | 68 |
} |
69 |
+ |