shell - How to read from file *and* stdin in bash -


This is my job: read some data from the file line from the line, for each row, if it satisfies some condition , Ask the user to input some and proceed according to user input.

I know how to read a line-by-line content from a shell script: line while reading; Echo $ line $ & lt; File.txt

However, if I want to interact with the user inside loop body, conceptually, what I want is:

  while reading; Do echo "This is what you want: $ line [y] es / [n] o" # This problem is: # I want to read from some standard input here. # However, inside the loop body, the standard input is redirected to file.txt INPUT if [[INPUT == "Y"]]; Then fixed the $ line & lt; File.txt   

Should I use another way of reading files? Or open the file on a file descriptor except for standard reading? "post-text" itemprop = "text">

For example:

  read -u 3 line; Read from FD3 read # -P "Y or N:" read the INPUT # standard input if [[INPUT == "Y"]]; Then the $ 3 file for the input line    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -