Finished Submission Count Input Validation.
parent
aedd710e9a
commit
04d5934ce6
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
i=1
|
||||
rep=$1 # how many submissions to generate
|
||||
#To Do: use Curl to scrape furaffinity.net's main page and find a way to parse down to the first submission found.
|
||||
maxsubs=52089873 #sets the default maximum bound of submission depth
|
||||
# It's recommended to set the max subs yourself, as there isn't a good
|
||||
# way to poll the website and check for that.
|
||||
|
@ -9,26 +10,31 @@ minsubs=0 #sets the default minimum bound of submission depth
|
|||
minsubarg=$2
|
||||
echo "===FA.SH: The Random FA Sub Generator==="
|
||||
|
||||
# Check if the rep argument was filled already, test for non-numbers.
|
||||
|
||||
# if [[ -n "$rep"]]; then
|
||||
# This works, only if it's empty. wat.
|
||||
if [[ $rep != [0-9]* ]]; then
|
||||
echo "Submission Count Argument is not an integer"
|
||||
exit
|
||||
fi
|
||||
# fi
|
||||
|
||||
# Todo: Validate the rep count is only numbers.
|
||||
validate=1
|
||||
# Validate the rep count is only numbers.
|
||||
while [ $validate -eq 1 ]
|
||||
do
|
||||
if [[ -z "$rep" ]]; then
|
||||
validate=1
|
||||
echo "///"
|
||||
echo "How many submissions to pull? (Default: 1)"
|
||||
echo "///"
|
||||
read rep
|
||||
else
|
||||
echo "debug: sub argument already provided."
|
||||
|
||||
fi
|
||||
|
||||
if [[ -n "$rep" ]]; then
|
||||
echo "Debug: Checking Submission Input."
|
||||
if [[ $rep != [0-9]* ]]; then
|
||||
echo "Submission Argument Not an Integer."
|
||||
unset rep
|
||||
else
|
||||
((validate--));
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo "debug: amount of submissions requested: $rep"
|
||||
if [[ -z "$minsubarg" ]]; then
|
||||
echo "debug: no minimum sub id given"
|
||||
|
@ -36,10 +42,6 @@ else
|
|||
echo "debug: minimum sub id: $minsubarg"
|
||||
fi
|
||||
|
||||
if [[ -z "$rep" ]]; then # bugfix for no arguments / null read.
|
||||
rep=1
|
||||
fi
|
||||
|
||||
echo "debug: max sub id: $maxsubs"
|
||||
|
||||
if [[ $minsubarg -gt $minsubs ]]; then
|
||||
|
|
Loading…
Reference in New Issue