new to bash. i want a "while read line" loop the gets input from a command-in this case, grep. i want the read to read each line the grep returns and insert it as a string to the "line" var. in case the grep returns no results, i still want it to enter the loop so i can printf something and then continue. will it work? here's the code segement:
while read -r line: do
...(irrelevent)...
done<$(grep $id ${arrpre[$j]}.course)
${arrpre[$j]}.course is the name of the file. tnx for the help!
grep, or from a file named as the output of grep? This code is doing the latter.done < <(grep ...)ordone <<<"$(grep ...)"grep ... | while ....