From 1e672f042b482faed5f08568b622e462beec8497 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 19 Aug 2013 08:58:15 +0000 Subject: [PATCH] Si on CTRL+C fixperms, ca propose de pas retourner d'erreur. Pratique lors des upgrades --- src/fixperms.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/fixperms.sh b/src/fixperms.sh index f55e16b2..91f9160b 100755 --- a/src/fixperms.sh +++ b/src/fixperms.sh @@ -162,6 +162,24 @@ fixfile() { echo file ownership and ACLs changed } +ctrl_c() { + echo -e "\n***** INTERRUPT *****" + echo "$0 was interrupted. Default is to return an error code." + echo "Do you want to *ignore* the error code (y/n)?" + echo "(default is n)" + read -N 1 ans + case "$ans" in + y|Y ) + exit 0 + ;; + * ) + exit -5 + ;; + esac +} + +trap ctrl_c SIGINT + #Start of the script actions if [[ "$file" != "" ]]; then # if we are dealing with a file if [ -e "$file" ]; then