Files
guess/bash/randTest.sh
2026-05-05 08:12:46 -07:00

23 lines
327 B
Bash
Executable File

#!/usr/bin/env bash
# set script restart
script=$(readlink -f "$0")
# Select number
echo "Pick a number:"
read num
# Output response
echo "The random number is $((1 + $RANDOM % $num))."
# Ask to run again
echo "Run script again (yes/no)?"
read answer
if [ "$answer" = yes ]
then exec "$script"
fi
echo "Exiting"
exit 0