Add better console work to scripts

This commit is contained in:
Matt McWilliams 2021-11-29 11:30:51 -05:00
parent a3b0bfe950
commit a9456c569e
2 changed files with 6 additions and 4 deletions

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
askContinue () { askContinue () {
echo "${1}"
echo "Are you ready to continue? (yes/no)" echo "Are you ready to continue? (yes/no)"
read input read input
if [ "$input" != "n" ] && [ "$input" != "no" ] if [ "$input" != "n" ] && [ "$input" != "no" ]
then then
echo "${1}" echo "${2}"
else else
exit 1 exit 1
fi fi

View File

@ -21,10 +21,11 @@ if [[ "${3}" != "" ]]; then
fi fi
if [[ "${2}" == "" ]] || [[ $2 -eq 0 ]]; then if [[ "${2}" == "" ]] || [[ $2 -eq 0 ]]; then
echo "Drawing focus field..."
name=`basename "${1}"` name=`basename "${1}"`
bash field.sh "${name}" bash field.sh "${name}"
askContinue "Starting with first frame..." askContinue "Start with first frame?" "Starting with first frame..."
else else
c=0 c=0
for svg in "${1}"*.svg ; do for svg in "${1}"*.svg ; do
@ -36,7 +37,7 @@ else
echo "Starting frame: ${filename}" echo "Starting frame: ${filename}"
break break
done done
askContinue "Continuing with frame ${filename}..." askContinue "Start with ${filename}" "Continuing with frame ${filename}..."
fi fi
i=0 i=0
@ -64,6 +65,6 @@ for svg in "${1}"*.svg ; do
exit exit
fi fi
askContinue "Continuing with next frame..." askContinue "Finished frame ${filename}" "Continuing with next frame..."
done done