raspberry pi – Running hci lescan with timeout breaks the command
So the command sudo hcitool lescan
outputs bluetooth addresses until ctrl+c is pressed. I want to have the command run for 20 seconds and capture the output. I tried running timeout 10 sudo hcitool lescan, but that gives me the following error: Set scan parameters failed: Input/output error
However, if I put sudo hcitool lescan
in a .sh
file and then run timeout 10 sh_file_name
, it finishes executing without an error.
I tried making a .sh
file with the following:
#!/bin/bash
output=$(timeout 10 ./test.sh 2>&1)
echo "$output"
However, now that gives me the original error.
What is the problem, and how do I fix it?
Read more here: Source link