I can almost undestand why
no_of_lines=`wc -l <$file`
stores the number of lines in file. But how does
no_of_lines2=`<$file wc -l`
also give the same answer?
I can almost undestand why
no_of_lines=`wc -l <$file`
stores the number of lines in file. But how does
no_of_lines2=`<$file wc -l`
also give the same answer?
Shell trivia: Redirections don't have to come after commands. That's where people usually put them, but they can actually be anywhere—at the end, at the beginning, or even in the middle.
These are all equivalent:
wc -l <file
<file wc -l
wc <file -l