A
A
Asriel2021-11-20 13:40:10
linux
Asriel, 2021-11-20 13:40:10

Why is the "done" unexpected (expecting "do") error?

Hello. When running the start.sh file on the server, it gave the error "done" unexpected (expecting "do")

Here is the script itself

#!/bin/sh
while sleep 1
do
python3 ./bot.py
done

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Kharchenko, 2021-11-20
@Asriel

This is how it should be:

#!/bin/sh
while true
do
python3 ./bot.py
sleep 1
done

sleep 1 can be changed to something else, or removed altogether. Or make some kind of "fuse" so that there are no problems to kill this script in the absence of a pause, if bot.py suddenly has problems (clogs memory, disk, or something else does not do it right).

R
Ronald McDonald, 2021-11-20
@Zoominger

while sleep 1 <-- тут должно быть условие, а не инструкция
do
python3 ./bot.py
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question