在script中從標準輸入讀東西 - Linux
By Una
at 2011-05-12T19:00
at 2011-05-12T19:00
Table of Contents
※ 引述《x3795566 (冀憶)》之銘言:
: 我知道可以用$<:q
: 一行一行的讀標準輸入的東西
: 但是假如 我用 cat tempfile | ./myscript 時
: 我要怎樣知道已經讀完了?
: 原本是想說判斷是不是沒東西
: 但是假如tempfile有空白行就又行不通
: 不知道有沒有人知道怎樣判斷標準輸入結尾了> <
: 感激不盡
空白行先用 sed '/^$/d' 處理掉呢?
--
: 我知道可以用$<:q
: 一行一行的讀標準輸入的東西
: 但是假如 我用 cat tempfile | ./myscript 時
: 我要怎樣知道已經讀完了?
: 原本是想說判斷是不是沒東西
: 但是假如tempfile有空白行就又行不通
: 不知道有沒有人知道怎樣判斷標準輸入結尾了> <
: 感激不盡
空白行先用 sed '/^$/d' 處理掉呢?
--
Tags:
Linux
All Comments
By Daph Bay
at 2011-05-14T02:38
at 2011-05-14T02:38
By Hedda
at 2011-05-17T10:29
at 2011-05-17T10:29
By Frederica
at 2011-05-19T01:09
at 2011-05-19T01:09
By Quanna
at 2011-05-20T12:56
at 2011-05-20T12:56
By Andrew
at 2011-05-23T18:08
at 2011-05-23T18:08
By Necoo
at 2011-05-27T06:34
at 2011-05-27T06:34
By Zenobia
at 2011-05-28T02:13
at 2011-05-28T02:13
By Rae
at 2011-05-29T22:53
at 2011-05-29T22:53
By Eden
at 2011-06-01T06:25
at 2011-06-01T06:25
By Eden
at 2011-06-03T13:12
at 2011-06-03T13:12
By Caitlin
at 2011-06-03T16:44
at 2011-06-03T16:44
By Kelly
at 2011-06-05T21:51
at 2011-06-05T21:51
By Carolina Franco
at 2011-06-05T23:42
at 2011-06-05T23:42
By Leila
at 2011-06-09T15:08
at 2011-06-09T15:08
By Edwina
at 2011-06-13T05:46
at 2011-06-13T05:46
Related Posts
LinuxMint 11 "Katya" RC
By Liam
at 2011-05-12T16:59
at 2011-05-12T16:59
觸控版,螢幕開機黑屏,電力顯示,FX安裝
By Kama
at 2011-05-12T11:29
at 2011-05-12T11:29
Putty 下載檔案問題
By Elvira
at 2011-05-12T11:20
at 2011-05-12T11:20
被吃掉的title bar
By Andy
at 2011-05-12T01:20
at 2011-05-12T01:20
Error 18: selected cylinder exceeds maximum supported by
By Mason
at 2011-05-11T21:59
at 2011-05-11T21:59