因此,我正在爲Kali Linux編寫一個腳本,它將我的網卡置於監視模式。但是當我試圖運行它時,我遇到了第八行中的do命令的問題。下面是代碼:收起這個Shell腳本什麼是錯誤的
#!/bin/bash
echo "Preparing to enter monitor mode."`
檢查,看看Firefox的運行
ps cax | grep firefox > /dev/null
if [ $? -eq 0 ]; then
echo "Firefox is running. It needs to be closed in order to properly enter monitor mode." #If it is offers to close it
echo "Would you like me to close it for you?"
select yn in "Yes" "No"; do
case $yn in
Yes) pkill firefox; echo "Firefox killed. Proceeding to enter monitor mode."; echo "Press any button when ready"; wait;;
No) echo "Proceeding to enter monitor mode."; echo "Press any button when ready."; wait;;
else
echo "Proceeding to enter monitor mode."
echo "Press any button when ready"
wait
fi
詢問無線接口的名稱設置變量
echo "What is the name of your wireless interface?"
read interfacevar
echo Thank you. Entering $interfacevar into monitor mode.
airmon-ng start $interfacevar
airmon-ng check kill
echo "Complete! Exiting in:"
echo "5"
sleep 1s
echo "4"
sleep 1s
echo "3"
sleep 1s
echo "2"
sleep 1s
echo "1"
sleep 1s
echo "Goodbye!"
exit
但後來我得到的問題說,該做的在第8行是不正確的。
使用[shellcheck.net](http://shellcheck.net)來診斷您的腳本。 – mklement0