title: Why does this simple bash code give a syntax error?
body: <p>I have the following bash code, which is copied and pasted from "bash cookbook" (1st edition):</p>
  
  <pre><code>#!/bin/bash
  
  VERBOSE=0;
  if [[ $1 =-v ]]
  then
      VERBOSE=1;
      shift;
  fi
  </code></pre>
  
  <p>When I run this (bash 4.0.33), I get the following syntax error:</p>
  
  <pre><code>./test.sh: line 4: conditional binary operator expected
  ./test.sh: line 4: syntax error near `=-v'
  ./test.sh: line 4: `if [[ $1 =-v ]]'
  </code></pre>
  
  <p>Is this as simple as a misprint in the bash cookbook, or is there a version incompatibility or something else here? What would the most obvious fix be? I've tried various combinations of changing the operator, but I'm not really familiar with bash scripting.</p>