title: Bash single quotes inside double quotes
body: <p>I want to execute the command:</p>
  
  <pre><code>xcodebuild -exportArchive -exportFormat IPA -archivePath myApp.xcarchive -exportPath myApp.ipa -exportProvisioningProfile 'myApp adhoc'
  </code></pre>
  
  <p>The above command works fine when simply executing in terminal. However, I am attempting to execute the command inside a wrapper function in bash. The wrapper function works by being passed a command and then executing that command basically. For example, a call to the wrapperFunction:</p>
  
  <pre><code>wrapperFunction "xcodebuild -exportArchive -exportFormat IPA -archivePath myApp.xcarchive -exportPath myApp.ipa -exportProvisioningProfile 'myApp adhoc'"
  </code></pre>
  
  <p>and the wrapperFunction itself:</p>
  
  <pre><code>wrapperFunction() {
      COMMAND="$1"
      $COMMAND
  }
  </code></pre>
  
  <p>The problem is the single quotes in <code>'myApp adhoc'</code>, because when running the command through wrapperFunction I get the error: <code>error: no provisioning profile matches ''myApp'</code>. It is not picking up the full name of the provisioning profile <code>'myApp adhoc'</code></p>
  
  <p><strong>EDIT:</strong> so say I also wanted to pass another string to wrapperFunction that was not part of the command to be executed. For example I wanted to pass a string to display if the command fails. Inside wrapperFunction I could check $? after the command and then display the failure string if $? -ne 0. How can I also pass a string with the command?</p>