function tnum () {
# prompts user for value 
read -p "Input a number : " num

# check that it is integer of 1 or more digits.
# Until a good number given or q typed, keep asking.
until echo "$num" | grep "^[0-9][0-9]*$" > /dev/null 2>&1
do
  # if q entered, user Signaling quit.
  if [ "$num" = 'q' ]
  then
    num=""
    break
  fi

  # ask again
  read -p "Bad number, Input a number : " num
done
}
