
當我跑步時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 將產生所需的輸出。