Difference between "Command substitution" and "Process substitution"

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?

I don't understand what you mean by command and process substitution. I see no point in using IFS in this example as you said yourself.

Also I would go by

while read -r line; do
     echo $line
done < file

Cat'ting the file is not needed.

if you are using bash, try this

while IFS='\n' read -r line; do  echo $line; done <<< $(cat file) 

<<< is here-string

Hi,

$(...) means execute the command ... and print the output
to the command line.
<(...) and =(...) create a temporary file of the output and
redirect the output of this to the command line.

To understand the difference try:

diff $(ls) $(ls)

and

diff <(ls) <(ls)

The first will fail as diff expects input from a file.

HTH Chris