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