因此,我正在为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