22 lines
326 B
Bash
Executable File
22 lines
326 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
|