I am writing a bash script for a c program, where the program asks for a 4 numerical pin inputs. However, when I wrote the script, the output seems to run in a loop, but it doesn't break where it gets identified as the correct number the program will accept.
#!/bin/bash RANGE=9000 count=${RANDOM:0:4} while [[ "$count" -le $RANGE ]] do number=$RANDOM (( "number %= $RANGE" )) echo $number if [[ "$count" == "$RANGE" ]]; then break fi done When I run it, I can see some numbers in the output that returned as 2 or 3 digits, instead of 4. So in theory, what I want to do is find a random number that is 4 digits that the program will take, but I don't know what is the random number, so essentially it is a brute force, or just me manually guessing the pin number.
(( number %= RANGE )); no need for$s or quotes.