Hi,
What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution?
while IFS= read -r line; do echo $line; done < <(cat file)
executes successfully and display the contents of the file
But,
while IFS='\n' read -r line; do echo $line; done < $(cat file)
gives error as: bash: $(cat file): ambiguous redirect (same results for backticks syntax instead of "$()")
Also, please clarify to me whether 'IFS' is really required in this while loop as it seems to be redundant because by default read command will fetches the entire line if only one argument is supplied and no delimiter is needed here to print every line???
Is there any use case(s) available that the IFS presence is mandatory to print each and every line of a file?