The file tmp.sh contains:
func() {
ls
}
If the file is sourced using source tmp.sh, the function func works fine.
However, if the sourcing is done as cat tmp.sh | source /dev/stdin bash complaints:
-bash: func3: command not found
What is the difference between the two methods of sourcing? From source's perspective there should not be any difference since /dev/stdin would also be a file handle.