From bd1d604ccc7c784e62a705b9c849014e45dda4ca Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 10 Oct 2008 18:40:15 +0200 Subject: extr function: *.shar: Confirm shar extraction --- etc/functions/extr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'etc/functions') 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 { -- cgit v1.2.3