簡體   English   中英

設置此Shell腳本有什么問題

[英]Setiing Up This Shell Script What Is Wrong With It

因此,我正在為Kali Linux編寫腳本,該腳本會將網卡置於監視模式。 但是在嘗試運行它時,我在第八行的do命令遇到了問題。 這是代碼:

#!/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行中的do是不正確的。

問題在於,當您應該使用esac完成時,您正在與else case一起完成一個格case

您可以通過添加一行來修復它

esac

就在else之前

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM