For class I need to write a Bash script that will take the output from ispell and when I try and request user input inside the while loop it just saves the next line of the file as the user input.How could I go about requesting user input in the while loop?#!/bin/bash#Returns the misspelled words#ispell -l < file#define varsISPELL_OUTPUT_FILE=output.tmp;INPUT_FILE=$1ispell -l < $INPUT_FILE > $ISPELL_OUTPUT_FILE;#echo a new line for give space between command#and the output generatedecho ;while read line;do   echo '$line' is misspelled. Press Enter to keep;   read -p this spelling, or type a correction here:  USER_INPUT;   if [ $USER_INPUT !=  ]   then      echo INPUT: $USER_INPUT;   fi   echo ; #echo a new linedone < $ISPELL_OUTPUT_FILE;rm $ISPELL_OUTPUT_FILE;
Requesting user input while reading file line by line
bash;shell script;control flow;user input
You can't do that in your while. You need to use another file descriptorTry the following version :#!/bin/bash#Returns the misspelled words#ispell -l < file#define varsISPELL_OUTPUT_FILE=output.tmp;INPUT_FILE=$1ispell -l < $INPUT_FILE > $ISPELL_OUTPUT_FILE;#echo a new line for give space between command#and the output generatedecho ;while read -r -u9 line;do   echo '$line' is misspelled. Press Enter to keep;   read -p this spelling, or type a correction here:  USER_INPUT;   if [ $USER_INPUT !=  ]   then      echo INPUT: $USER_INPUT;   fi   echo ; #echo a new linedone 9< $ISPELL_OUTPUT_FILE;rm $ISPELL_OUTPUT_FILESee How to keep other commands from eating the inputNOTESUSE MORE QUOTES! They are vital.  See http://mywiki.wooledge.org/Quotes and http://wiki.bash-hackers.org/syntax/wordsbash is not C or Perl, no need to put ; on each end lines