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"