0

I am trying to write a bash script that takes some data from users and display their entered information back to them. I take date and time using following:

echo "Enter day:"
read day
echo "Enter time (hour):"
read hour

if [["$hour" -gt 24 || "$hour" -lt 1]] 
then
echo "Wrong data"
echo "Enter time (hour):"
read hour
fi

When I run this I get following enter:

./file1.sh: line 5: [[27: command not found
./file1.sh: line 5: 27: command not found

27 is the number I entered for hour.

John Smith
  • 15
  • 1
  • 5
  • Put a space after `[[` and before `]]`, like this: `[[ "$hour" -gt 24 || "$hour" -lt 1 ]] ` – janos Nov 05 '16 at 18:36

1 Answers1

0

You need a space after [[ and before ]].

Chris
  • 1,613
  • 17
  • 24