summaryrefslogtreecommitdiff
path: root/etc/functions
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-10-10 18:40:15 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-10-10 18:40:15 +0200
commitbd1d604ccc7c784e62a705b9c849014e45dda4ca (patch)
tree150fb9b58dba18a214b68631d69a4d3f1b191db0 /etc/functions
parent2157a0fc5ab6a0a66904840408573de1d9a32e44 (diff)
extr function: *.shar: Confirm shar extraction
Diffstat (limited to 'etc/functions')
-rw-r--r--etc/functions/extr8
1 files changed, 7 insertions, 1 deletions
diff --git a/etc/functions/extr b/etc/functions/extr
index 830d263..3b01572 100644
--- a/etc/functions/extr
+++ b/etc/functions/extr
@@ -1,5 +1,11 @@
# builtin function for archives, see $ZDIR/alias_suffix
## vim:ft=zsh
+
+function confirm_shar {
+ echo -ne "${warn}shar archives are shell scripts and can easily contain malicious code.${reset} Proceed/ [y/N] "
+ read -q
+}
+
if [[ -f $1 ]] {
case $1 in
*.tar.bz2) tar xvjf $1 ;;
@@ -15,7 +21,7 @@ if [[ -f $1 ]] {
*.tbz2) tar xvjf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
- *.shar) sh $1 ;;
+ *.shar) confirm_shar && sh $1 ;;
*) echo "Unknown archive type: $1"; exit 2 ;;
esac
} else {