Bash
退出腳本
我在一個簡單的腳本中執行 aircrack-ng cmd
#! /bin/bash clear echo "enter router mac \n" read mac echo "enter path to word list \n " read list echo "enter path to file contain handshake \n" read handshake aircrack-ng -b $mac -w $list $handshake
當我按
ctrl
+c
腳本終止但 aircrack-ng 仍在工作時。我知道這可能很簡單,但我是新手。
當您按
Ctrl
+時C
,您正在向在前台執行的作業發送信號(SIGINT)以被中斷,這樣的作業是腳本,而不是aircrack-ng
.不過,您可以做的是控制腳本在收到 SIGINT 時的行為方式:
#! /bin/bash trap "pkill aircrack-ng && exit" SIGINT SIGTERM clear echo "enter router mac \n" read mac echo "enter path to word list \n " read list echo "enter path to file contain handshake \n" read handshake aircrack-ng -b $mac -w $list $handshake