Yes, diff <(echo "$foo") <(echo "$bar") is fine.
By searching the bash manpage for the characters <(, you can find that this is
called “process substitution.”
You don't need to worry about the efficiency of creating a temporary file,
because the temporary file is really just a pipe, not a file on disk. Try this:
$ echo <(echo foo
(
Read more... )