プログラム出力がgrepではないのはなぜですか? [コピー]

プログラム出力がgrepではないのはなぜですか? [コピー]

私が実行すると、sudo wpa_supplicant -Dwext -iwlan3 -cwifi.conf 2>&1次のようになります。

Successfully initialized wpa_supplicant
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan3: Trying to associate with 9c:3d:cf:fb:95:96 (SSID='Bell514' freq=2462 MHz)
wlan3: Association request to the driver failed
wlan3: Associated with 9c:3d:cf:fb:95:96
wlan3: Authentication with 9c:3d:cf:fb:95:96 timed out.

しかし、私が実行したとき:

sudo wpa_supplicant -Dwext -iwlan3 -cwifi.conf 2>&1 | grep --line-buffered wlan3

私はちょうど次を得ます:

ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

正しくリダイレ​​クトされませんかstderr

ベストアンサー1

パイプラインコンシューマgrepはラインバッファリングされます。しかし、これはパイプメーカーには影響しません。パイプgrepの対応する側面を調整すると、所望の出力が生成されます。

おすすめ記事