關於LS > C有感

關於這樣一段代碼

[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中。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章