user5517962
user5517962

Reputation:

Send Ctrl+C from .sh script

I am running hcitool application ($hcitool lescan). It detects all the bluetooth connected devices and shows the UUID for each. I press Ctrl+C when I see sensortag UUID B0:B4:48:BD:0F:83 and proceed. I want all this to be done using a .sh script. Please guide.

Upvotes: 0

Views: 2580

Answers (2)

Harshit Gupta
Harshit Gupta

Reputation: 1

kill -INT process_ID

CTRL + C sends a SIGINT signal. kill also does the same. So, just pass the process ID to the above command.

To get the PID(process ID) type command : pgrep foo(suppose foo is your process)

Upvotes: 0

Karoly Horvath
Karoly Horvath

Reputation: 96266

grep can quit immediately when a pattern is found:

hcitool lescan | grep -q 'B0:B4:48:BD:0F:83'

Upvotes: 2

Related Questions