Question about why a command does this
Code:
$ echo 2 * 3 > 5 is a valid inequality. What I do not understand is why 'is a valid inequality' gets written to this file. I thought it would write '2', all the file names in the current directory, then '3' into the file called '5'. Why does the 'is a valid inequality.' get written to the file also? |
Hmm.. What shell are you using, and what version? Not sure if it matters, but thought I'd ask, since for me, the command works as you would expect it to, I think:
Code:
root@reactor: echo 2 * 3 > 5 |
bash 3.2.something I think (it says bash 3.2 when I do $SHELL but I remember seeing a bunch of other numbers somewhere else)
Code:
$ echo 2 * 3 > 5 is a valid inequality. |
yes i get the same results as you OP. Here is something else to prove the point:
Code:
echo > 7 one two * three Echo is treating all fields presented to it individually, as there are no quotes. The moment it finds the redirection it knows that it should send all data it finds to that location. As it then finds more strings on the line it then processes those and acts accordingly. |
All times are GMT -5. The time now is 05:02 PM. |