title: shell script issue with positional arguments and if else
body: <p>I'm trying to write a script that will accept positional arguments (command-line arguments) that specify a mathematical operation (add, sub, mult, div, mod) and two values. The script is supposed to get this input, compute the result, and display the answer. I'm not sure where I went wrong because when I try to run my script, this is what I get</p>
  <blockquote>
  <pre><code>./trial.sh mod 15 10
  ./trial.sh: 6:        if [[ mod == add ]] then: not found
  Result:  25
  ./trial.sh: 9:        elif [[ mod == sub ]] then: not found
  Result:  5
  ./trial.sh: 12:        elif [[ mod == mult ]] then: not found
  Result:  150
  ./trial.sh: 15:        elif [[ mod == div ]] then: not found
  Result:  1
  ./trial.sh: 18:        elif [[ mod == mod ]] then: not found
  Result:  5
  ./trial.sh: 21:        else: not found
  error
  ./trial.sh: 23: fi: not found
  </code></pre>
  </blockquote>
  <p>This is the code I used that presented that result</p>
  <pre><code>#!/bin/bash
          a=$1
          b=$2
          c=$3
          result=0        
  &quot;       if [[ $a == add ]] then&quot;
             result=$((b + c))
             echo &quot;Result: &quot; $result
  &quot;       elif [[ $a == sub ]] then&quot;
             result=$((b - c))
             echo &quot;Result: &quot; $result
  &quot;       elif [[ $a == mult ]] then&quot;
             result=$((b * c))
             echo &quot;Result: &quot; $result
  &quot;       elif [[ $a == div ]] then&quot;
             result=$((b / c))
             echo &quot;Result: &quot; $result
  &quot;       elif [[ $a == mod ]] then&quot;
             result=$((b % c))
             echo &quot;Result: &quot; $result
  &quot;       else&quot;
             echo &quot;error&quot;
          &quot;fi&quot;
  </code></pre>