I am trying to print a random line from a text file that has 10 lines. The problem that I run into is that it sometimes picks the number "0" which is not a line in the text file. How would I have it pick a random number between 1-10?
#!/bin/bash
RANGE=10
number=$RANDOM
let "number %= $RANGE"
NAME=$(awk 'NR=='$number'{print;exit}' /home/names)
echo "$NAME"
Thanks to anyone who can help.