The function's read
command is using the same stdin as the while loop's read
. Use a different file descriptor. Also, the function can be simpler:
func_yesno() { typeset answer PS3="Cancel (y/n)?" select answer in Yes No; do case $answer in Yes) exit 0 ;; No) echo "ok"; break ;; esac done } while read -u3 line; do echo "line: $line" func_yesno done 3< unique.txt