Linux 设置这个Shell脚本有什么问题
因此,我正在为Kali Linux编写一个脚本,它将使我的网卡进入监视模式。但是我在尝试运行第八行中的do命令时遇到了问题。代码如下:Linux 设置这个Shell脚本有什么问题,linux,bash,shell,Linux,Bash,Shell,因此,我正在为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 or
#!/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不正确。问题是您正在使用
else
完成案例
块,而您应该使用esac
您可以通过添加一行来修复它
esac
就在
else
用于诊断脚本之前。好吧,我不会撒谎。我不知道这意味着什么,我基本上是通过大量的谷歌搜索来设置这个脚本的。要使脚本正常工作,我需要在脚本中更改什么?您使用的是具有特殊语法的复合命令。你可以通过manbash | sed-n'/^\s\{7\}case/,/list\.$/p'
阅读这方面的内容。或者看看这里: