S
S
SinSin352020-11-05 05:12:51
bash
SinSin35, 2020-11-05 05:12:51

Compare time in bash?

Hello, I just started learning bash and I don’t understand why the code gives an error.
I’m trying to compare the current time with the given one so that if the comparison is successful, output a message to the console.
However, it doesn’t go beyond line 8
5fa35f9335ac8936265445.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hint000, 2020-11-05
@SinSin35

add a space after [

C
CityCat4, 2020-11-05
@CityCat4

There must be spaces after the opening square bracket and before the closing square bracket . I.e:

# Неверно, выдаст ошибку
if [$length -ge 25]; then
 echo "Oooo, too big..."
fi

# Верно
if [ $length -ge 25 ]; then
 echo "Oooo, too big..."
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question