Bart Friederichs
Bart Friederichs

Reputation: 33533

How can I scan for a bluetooth device in a script?

I know I can use bluetoothctl scan on to scan for a device. But when I want to use this in a bash script, this is not usable, as this command never ends.

I would like a command that scans for say 30 seconds and prints whatever it found to standard out.

Is that possible with bluetoothctl or any other tool?

Upvotes: 2

Views: 2294

Answers (1)

cordigliere
cordigliere

Reputation: 66

you can use --timeout <seconds> to use it in non interactive mode e.g:

bluetoothctl --timeout 20 scan on

It will stop the scan after 20 sec

Upvotes: 4

Related Questions