From 911d6e210848ea9b02eb9fda74b17c5779224def Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 16 Sep 2021 11:05:07 -0400 Subject: [PATCH] Add a script for common functions --- common.sh | 12 ++++++++++++ draw.sh | 11 +---------- 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 common.sh diff --git a/common.sh b/common.sh new file mode 100644 index 0000000..7ebc015 --- /dev/null +++ b/common.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +askContinue () { + echo "Are you ready to continue? (yes/no)" + read input + if [ "$input" != "n" ] && [ "$input" != "no" ] + then + echo "${1}" + else + exit 1 + fi +} \ No newline at end of file diff --git a/draw.sh b/draw.sh index 951ee3b..67cb89c 100644 --- a/draw.sh +++ b/draw.sh @@ -8,16 +8,7 @@ # ########################### -askContinue () { - echo "Are you ready to continue? (yes/no)" - read input - if [ "$input" != "n" ] && [ "$input" != "no" ] - then - echo "${1}" - else - exit 1 - fi -} +source ./common.sh if [[ "${1}" == "" ]]; then echo "Please provide a directory as the first argument"