title: How to set Jenkins environment variable from script
body: <p>I'm trying to setup a script to increment the build number of my Xcode project. I make an API call to get the current build number, then I wanted to increment it and apply that new number as an environment variable so that the Xcode Plugin can use it.</p>
  
  <p>I have the EnvInject plugin installed but I don't know how to get the var from my shell script into a Environment Variable. </p>
  
  <pre><code>APP_BUILD_NUMBER=$(curl --request GET 'https://api.domain.com/api/GetBuildNumber')
  APP_BUILD_NUMBER=$((APP_BUILD_NUMBER +1))
  </code></pre>
  
  <p>This sets <code>APP_BUILD_NUMBER</code> to the value I need, but how do I assign this to a environment variable so I can access it later on in my job?</p>