diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-10-10 18:40:15 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-10-10 18:40:15 +0200 |
commit | bd1d604ccc7c784e62a705b9c849014e45dda4ca (patch) | |
tree | 150fb9b58dba18a214b68631d69a4d3f1b191db0 | |
parent | 2157a0fc5ab6a0a66904840408573de1d9a32e44 (diff) |
extr function: *.shar: Confirm shar extraction
-rw-r--r-- | etc/functions/extr | 8 |
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 { |