I would like to know what is the syntax error in this bash srcipt
#!/bin/bash
CURRENT=1594184400
while true do
NEXT=$((CURRENT+300))
CURRENT=$NEXT
done
That I get
syntax error near unexpected token `done'
error?
I would like to know what is the syntax error in this bash srcipt
#!/bin/bash
CURRENT=1594184400
while true do
NEXT=$((CURRENT+300))
CURRENT=$NEXT
done
That I get
syntax error near unexpected token `done'
error?
You either need a semicolon after true on the second line or to put do on the following line by itself.
Either this:
#!/bin/bash
CURRENT=1594184400
while true; do
NEXT=$((CURRENT+300))
CURRENT=$NEXT
done
Or this:
#!/bin/bash
CURRENT=1594184400
while true
do
NEXT=$((CURRENT+300))
CURRENT=$NEXT
done
You can check shell scripts for errors here:
You can also run bash -n script on the terminal to check for errors.
do is simply parsed as an argument to true, and the parser is still looking for the required keyword do in a command position when it encounters done.