title: Run a command only once in a for loop in Bash
body: <p>I have the following pattern of bash code from a function:</p>
  
  <pre><code>for folder in ${FOLDER[@]}; do
      if [ $# -ne 0 ]; then
          rsync -rvh --delete-after ${folder} ${folder_dest}
      else
          local zipFile=$(stamp-files file.zip)
          unzip -q ${zipFile} "${folder}"*  -d "${folder_src}"
          rsync -rvh --delete-after ${folder_src}${folder} ${folder_dest}
          rsync -rvh --delete-after ${folder_src}${folder} ${folder_dest2}
      fi
  done
  </code></pre>
  
  <p>So in this function I have an if statement in a for loop. And as you can see in the else part there is a call to another function <code>stamp-files</code>. This call to the others functions is needed just in the first iteration and even if it is not causing any issue, it could be definitely improved by just calling it once.</p>
  
  <p>Do you know how could I do that simply and keeping that shape of code (the if statement in the for loop)?</p>