From 13bb00826c7aa9fc545b9f797e5cce4120752a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 25 Nov 2018 13:35:52 +0100 Subject: Cleanup and more I am just lazy to write it up. Nobody reads it anyway. --- utils/inst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'utils/inst') diff --git a/utils/inst b/utils/inst index 9987fff..34b2e87 100644 --- a/utils/inst +++ b/utils/inst @@ -1,14 +1,19 @@ # Functions used for interactive installation of new changes to running system # vim: ft=sh +# Ask if given section should be installed +# First argument is name (take care not to use special characters for regulard +# expression) and second argument is a question ask() { + grep -q "^$1$" ".ignore-$(hostname)" && return 1 if $FORCE; then - echo -e "\e[1;34m$1\e[0m" + echo "\e[1;34m$2\e[0m" # Fall trough with 0 exit (always yes) else - echo -e -n "\e[1;34m$1? (Y/n) \e[0m" - read - echo "$REPLY" | grep -qE '^[Yy]?$' + echo -e -n "\e[1;34m$2? (Y/n) \e[0m" + local reply + read -r reply + echo "$reply" | grep -qE '^[Yy]?$' fi } -- cgit v1.2.3