title: Why do I get an "unexpected operator" error for my condition in Bash?
body: <p>I got the code for monitoring apache. The name of the file is <code>test.sh</code>. I changed the code a bit.</p>
  
  <p>What I was looking for is, when I do:</p>
  
  <pre><code>./test.sh -H localhost -wr 2 -cr 5 -arg cpu_load
  </code></pre>
  
  <p>It should test apache for its <code>cpu_load</code>, i.e., I tried to control monitoring apache with my <code>-arg</code> parameter, but that doesn't seem to be working. </p>
  
  <p>When I run this:</p>
  
  <pre><code>./test.sh -H localhost -wr 2 -cr 5 -arg cpu_load
  </code></pre>
  
  <p>I get the error :</p>
  
  <pre><code>./test.sh: 282: [: -ge: unexpected operator
  ./test.sh: 286: [: -ge: unexpected operator
  </code></pre>
  
  <p>Here is some part of the code:</p>
  
  <pre><code>#!/bin/sh
  
  
  while test -n "$1"; do
      case "$1" in
          --help|-h)
              print_help
              exit $ST_UK
              ;;
          --version|-v)
              print_version $PROGNAME $VERSION
              exit $ST_UK
              ;;
          --hostname|-H)
              hostname=$2
              shift
              ;;
          --port|-P)
              port=$2
              shift
              ;;
          --timeout|-t)
              timeout=$2
              shift
              ;;
          --remote-server|-R)
              remote_srv=1
              ;;
          --binary_path|-b)
              path_binary=$2
              shift
              ;;
          --pid_path|-p)
              path_pid=$2
              shift
              ;;
          --pid_name|-n)
              name_pid=$2
              shift
              ;;
          --status-page|-s)
              status_page=$2
              shift
              ;;
          --secure|-S)
              secure=1
              ;;
          --warning-req|-wr)
              warn_req=$2
              shift
              ;;
          --critical-req|-cr)
              crit_req=$2
              shift
              ;;
      --userargument|-arg)
         user_arg=$3
         shift
             ;;
          *)
              echo "Unknown argument: $1"
              print_help
              exit $ST_UK
              ;;
      esac
      shift
  done
  
  #other codes
  
      if [ ${wclvls_req} = 1 ]
      then
          if [ ${user_arg} -ge ${warn_req} -a ${user_arg} -lt ${crit_req} ]
          then
              echo "WARNING - ${output} | ${perfdata}"
              exit $ST_WR
          elif [ ${user_arg} -ge ${crit_req} ]
          then
              echo "CRITICAL - ${output} | ${perfdata}"
          exit $ST_CR
          else
              echo "OK - ${output} | ${perfdata}"
              exit $ST_OK
          fi
      else
          echo "OK - ${output} | ${perfdata}"
          exit $ST_OK
      fi
  
  fi
  </code></pre>
  
  <p>Where am I making the mistake?</p>