"ls -l | wc -l" outputs "1+no. file/directories"(extra one for the first line).
However when I run the command ls -l | wc -l > temp (when output is redirected to a new file temp). The value stored in temp file is 1 more than the value which was outputted without redirection. I guess it is because of the new "temp" file created but the temp file should have been created after the ls -l command was run and thus, the output should be the same as the output without redirection.
Someone please help