我有一个shell脚本,可以使用以下命令启用ble设备扫描
timeout 10s hcitool lescan通过执行这个脚本(比如ble_scan),我可以看到终端上显示的附近设备。
但是,当我将其重定向到文件和终端时
./ble_scan | tee test.log我再也看不到屏幕上显示的附近设备和日志文件了。
./ble_scan 2>&1 | tee test.log上面的重定向也没有帮助,我在这里出了什么问题吗?
发布于 2016-04-28 17:10:38
如果该命令与文件输出的行为不同,您可以在script中运行它。
script test.log
#=> Script started, output file is test.log
./ble_scan
# lots of output here
exit
#=> Script done, output file is test.log请注意,该文件将包含特定于终端的字符,如在输出重定向中通常不会捕获的回车。
https://stackoverflow.com/questions/36909539
复制相似问题