[問題] shell 語法

看板LinuxDev作者 (Seamisai)時間16年前 (2009/07/25 02:25), 編輯推噓2(204)
留言6則, 4人參與, 最新討論串1/1
在執行shell command 可以指定一輸入檔案 如 command < file1 如果想要指定兩個以上檔案 指令為?? 似乎不是 command < file1 < file2 請問該怎麼做呢?? ( 不想使用cat將檔案全都集中到file1 再 command < file1 ) 謝謝 -- Se ami sai quando tutto finisce Se ami sai come un brivido triste Come in un film dalle scene già viste Che se ne va, oh no! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.87.135 ※ 編輯: Seamisai 來自: 140.116.87.135 (07/25 02:27)

07/25 14:16, , 1F
command < `cat file1 file2` 這樣咧?
07/25 14:16, 1F

07/25 15:33, , 2F
在bash: -bash: `cat file1 file2`: ambiguous redirect
07/25 15:33, 2F

07/26 01:24, , 3F
試試 cat file1 file2 | command -
07/26 01:24, 3F

07/26 15:38, , 4F
謝謝樓上 方法可行 想請問最後的"-"代表的意思是?
07/26 15:38, 4F

07/26 15:38, , 5F
因為我加不加"-"都可完成這項指令
07/26 15:38, 5F

07/29 13:08, , 6F
如果你的程式預設就是去讀stdin,那就不用加
07/29 13:08, 6F
文章代碼(AID): #1AQVo2BZ (LinuxDev)
文章代碼(AID): #1AQVo2BZ (LinuxDev)