title: Generate script in bash and save it to location requiring sudo
body: <p>In bash I can create a script with a here-doc like so as per this site:
  <a href="http://tldp.org/LDP/abs/html/abs-guide.html#GENERATESCRIPT" rel="noreferrer">http://tldp.org/LDP/abs/html/abs-guide.html#GENERATESCRIPT</a>  </p>
  
  <pre><code>(
  cat &lt;&lt;'EOF'
  #!/bin/bash
  #? [ ] / \ = + &lt; &gt; : ; " , * | 
  #/ ? &lt; &gt; \ : * | ”
  #Filename="z:"${$winFn//\//\\}
  echo "This is a generated shell script."
  App='eval wine "C:\Program Files\foxit\Foxit Reader.exe" "'$winFn'"'
  $App
  EOF
  ) &gt; $OUTFILE
  </code></pre>
  
  <p>If my <code>$OUTFILE</code> is a directory requiring <code>sudo</code> privileges where do I put the <code>sudo</code> command or what else can I do to make it work?</p>