New to shell script.
I know 'read' is used to read user input, and '-n' is the number of characters waiting for, 'k' is the variable name to store reply. What is '<&1' used for?
Here is the whole script:
#!/bin/bash
echo "Press 'q' to exit"
count=0
while : ; do
read -n 1 k <&1
if [[ $k = q ]] ; then
printf "\nQuitting from the program\n"
break
else
((count=$count+1))
printf "\nIterate for $count times\n"
echo "Press 'q' to exit"
fi
done