X-Git-Url: https://git.slaskete.net/einar-bin/blobdiff_plain/20bbdb7d638345f922e870ea5ebe576ff71659c0..906b740710a160ed1e95dcd001c1c658fa7b0347:/imgurgame.bash diff --git a/imgurgame.bash b/imgurgame.bash index 66bbe4e..88af620 100755 --- a/imgurgame.bash +++ b/imgurgame.bash @@ -5,7 +5,7 @@ readonly BROWSER="google-chrome" # Create a random imgur url that may or may not be valid imgururl() { - # 1/3% chance for length of 5, 6 or 7 length string + # 1/3 chance for length of 5, 6 or 7 length string STRLN=$((5 + ${RANDOM} % 3)) local ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${STRLN} | head -n 1) echo "http://i.imgur.com/${ID}.jpg" @@ -15,7 +15,7 @@ imgururl() { testimgur() { local URL=${1} local RESULT=$(curl -s -o /dev/null -I -w "%{http_code}" ${URL}) - if [[ ${RESULT} == 200 ]]; then + if [[ ${RESULT} == "200" ]]; then echo true else echo false @@ -31,7 +31,7 @@ main() { ${BROWSER} ${URL} > /dev/null 2>&1 local FAIL=0 else - FAIL=$(( ${FAIL}+1 )) + ((FAIL++)) fi done }