Note that the bash shell effectively removes the redirection from the command line before argument 0 is executed. This means that in the case of this command:
Code:
echo hello > greetings.txt
I feel it's telling before counting the number of arguments, redirection operator is ignored.
But later it says how it affects output erasing file case.
While scanning the line, the shell will see the > sign and will clear the file! Since this happens before resolving argument 0, this means that even when the command fails, the file will have been cleared!
Code:
[paul@RHELv4u3 ~]$ cat winter.txt It is cold today! [paul@RHELv4u3 ~]$ zcho It is cold today! > winter.txt -bash: zcho: command not found [paul@RHELv4u3 ~]$ cat winter.txt [paul@RHELv4u3 ~]$
Code:
zcho It is cold today! > winter.txt command processes internally?
1) > is ignored
2) Number of arguments are count. There are 2 arguments "It is cold today!" and winter.txt
3) then what? i don't know.
Comment