Variable does not get replaced inside ' ' in a bash function
<p>I need to put this</p>

<pre><code>gulp --cordova 'prepare ios' --buildVars='version:${buildVarVersion},target:${target}' --res=${target}
gulp --cordova 'build ios --device --release --codeSignIdentity=${codeSignIdentity}' --no-build --res=${target}
</code></pre>

<p>inside a function. The single quotes need to be preserved. I'm struggling with the correct escaping. I've tried:</p>

<pre><code>function buildIPA() {
  CFBundleIdentifier=$1
  target=$2
  version=$3
  codeSignIdentity=$4

  buildVarVersion="public";
  if [ "$version" = "enterprise" ]; then
      buildVarVersion="private";
  fi

  gulp --cordova \'prepare ios\' --buildVars=\'version:${buildVarVersion},target:${target}\' --res=${target}
  gulp --cordova \'build ios --device --release --codeSignIdentity=${codeSignIdentity}\' --no-build --res=${target}

};
</code></pre>

<p>But it seems that this translates to:</p>

<pre><code>gulp --cordova prepare ios --buildVars=version:${buildVarVersion},target:${target} --res=${target}
</code></pre>

<p>removing the single quotes alltogether.</p>