關於這樣一段代碼
[root@xx] cd /mnt/
[root@xx] ls
[root@xx] touch a b
[root@xx] ls
a b
[root@xx] ls > c
[root@xx] ls
a b c
[root@xx] cat c
a
b
c
可以看到,ls > c 的內容是 a,b,c,而不是將a,b送入文件c中,因此,我覺得執行 ls >c這樣簡單的命令,首先系統會判斷ls命令的正確和c文件是否存在的合理性,若c不存在,那會先生成c,之後纔會執行 ls,並將此時ls的值送入c中。