title: syntax error near unexpected token `fi' while checking no of arguments passed
body: <p>I am new to shell scripting and created a script to check arguments are passed or not using if else condition . But it is always giving a error <b>'syntax error near unexpected token `fi' </b>'<br/></p>
  
  <p>is it always required to use <b>';'</b> after if condition brackets.<br/>
  I runned it online on <a href="http://www.compileonline.com/execute_bash_online.php" rel="nofollow">http://www.compileonline.com/execute_bash_online.php</a> it is working well but not on my system(Centos 6.2). Am i missing something in env settings or is it something else.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>#!/bin/bash
  echo "print a message"
  if [ $# -eq 1 ]; then
      echo "Argument are passed to shell script"
  else
      echo "No arguments are passed to shell script"
  fi
  </code></pre>
  
  <p><strong>Error message</strong></p>
  
  <pre><code>[root@local shell_scripts]# sh test.sh 12 13
  test.sh: line 7: syntax error near unexpected token `fi'
  test.sh: line 7: `fi'
  [root@local shell_scripts]#
  </code></pre>
  
  <p><strong>my env details</strong></p>
  
  <pre><code>[root@local shell_scripts]# env
  SHELL=/bin/bash
  TERM=xterm
  HISTSIZE=1000
  SSH_CLIENT=192.168.1.17 49656 22
  PERL5LIB=/home/bharat/perl5/lib/perl5/x86_64-linux-thread-multi:/home/bharat/perl5/lib/perl5
  PERL_MB_OPT=--install_base /home/bharat/perl5
  SSH_TTY=/dev/pts/6
  USER=bharat
  PATH=/home/bharat/perl5/bin:/usr/kerberos/sbin:/home/bharat/perl5/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/bharat/bin
  MAIL=/var/spool/mail/bharat
  INPUTRC=/etc/inputrc
  LANG=en_US.UTF-8
  SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
  HOME=/root
  SHLVL=4
  PERL_LOCAL_LIB_ROOT=/home/bharat/perl5
  LOGNAME=bharat
  CVS_RSH=ssh
  LESSOPEN=|/usr/bin/lesspipe.sh %s
  G_BROKEN_FILENAMES=1
  PERL_MM_OPT=INSTALL_BASE=/home/bharat/perl5
  _=/bin/env
  [root@local shell_scripts]#
  </code></pre>