Hi there
I want to ask to a user something about each line of a file. This is my code:
#cat test.txt
first line
second line
third line
#cat test.sh
#!/bin/ksh
read_write () {
echo "Do you want to print the line (YES/NO)?\n"
read TEST
case ${TEST} in
YES) return 0;;
NO) return 1;;
*) read_write;;
esac
}
while read _line
do
read_write
done < ./test.txt
but when i run it:
#test.sh
Do you want to print the line (YES/NO)?
[...]
Do you want to print the line (YES/NO)?
./test.sh[7]: read_write: recursion too deep
How can I solve it?
Thanks in advance.
---------- Post updated at 04:46 PM ---------- Previous update was at 04:40 PM ----------
All right, I found the solution (I promise that I had search before I posted)
Sorry for the format, but the site doesn't allow me to publish urls