All,
I'm posting a query to the list after quite a long time.
I'll ask the question right away:
$cat < foo 2>errorfile bash: foo: No such file or directory
According to the above command, if foo doesn't exist and I redirect the error stream to a file, it should be stored in the file and not displayed on the terminal. But it still gets displayed!
At a point, I thought this is a trick question and thought that possibly, foo exists and its contents are what is shown on the display. (But that isn't really the case) (because the errorfile doesn't get created at all - not in the above one and not according to the answer I've given - i.e. being a trick question).
I think, though, there's something that I do not know about the input redirection ( i.e. left chevron '<') and hence I'm not able to answer this query. (because, possibly, the error redirection 2> command is ignored completely / not executed at all).
Can anybody point me to a link that explains why this happens in Bash ? (Or perhaps, even in Korn shell?) (or if anybody can put a brief explanation of this?)
-- Roshan Baladhanvi