Score:-3

syntax error near unexpected token

cn flag

I was writing a bash script where I faced the below error and I have no idea about the reason:

syntax error near unexpected token `fi'

my script:

#!/bin/bash

if [ 5 -gt 1 ]; than
echo "Hello world"
fi
Someone avatar
my flag
Welcome to ask ubuntu !!! You should accept the answer if you find it useful , Micheal H 's answer was helpful right ? Click on that up arrow button and tick it as accepted , So that he would get some reputation points for his answer and efforts .
Score:1
cn flag

You mistyped the keyword "then".

cn flag
opppss xD thanks a lot
Score:1
id flag

Try this:

if [ 5 -gt 1 ]
then
echo "Hello world"
fi
cn flag
thank you a lot
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.