Question

I am using a shell script to automatically search network access points, and in airodump you use ctrl + c to stop the search, and I am wanting to it cancel the search but keep my shell script running. Since I am wanting to do user input after I am done searching for wifi networks. I tried to use trap, and it stops airodump, and my script.

I am just wanting to stop airodump wifi search and move onto my shell script of user input.

Was it helpful?

Solution

It's not entirely clear to me, but I believe you are wanting the user to be able to interactively stop the search via ctrl-C and then be prompted for input. This should do that:

#!/bin/sh

trap 'test "$airo" && kill -2 $airo' 2
airodump ... &
airo=$!
wait
unset airo

# Commands here will execute after the user hits ctrl-C to terminate the search
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top