I have the following script:
#!/bin/bash
if [ "$EUID" -ne 0 ]
then
echo ''
echo 'Please run the script as root'
echo ''
exit
fi
for run in {1..11}
do
sudo ./start_ap.sh
sleep 10
sudo ./tst.sh
done
The problem is that after executing
sudo ./start_ap.sh
the next lines will not be executed, because the line sudo ./start_ap.sh needs CTRL+C to stop and only then next lines will be executed.
However, I want that the sudo ./start_ap.sh will be terminated after sudo ./tst.sh and at next step this will be repeated 11 times.
So far, after execution of sudo ./start_ap.sh, the next lines will not be executed without killing its process.
How can I realize it?
P.S. start_ap.sh starts the hostapd and that's why it needs killing for next executions.
start_ap.shin the first place?sudolater?