title: Syntax error: "(" unexpected -- with !(*.sh) in bash script
body: <p>I want to run a sh file:</p>
  
  <pre><code>#!/bin/bash
  for f in !(*.sh); do
      ffmpeg -i "$f" -vf yadif=0:-1 -threads 0 -c:v libx264 -pix_fmt yuv420p \
          -r 29.97 -b:v 3000k -s 1280x720 -preset:v slow -profile:v Main \
          -level 3.1 -bf 2 -movflags faststart /mnt/media/out-mp4/"${f%.mxf}.mp4"
      rm $f
  done
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <pre><code>2: task1.sh: Syntax error: "(" unexpected
  </code></pre>
  
  <p>If I try directly on the command line it works perfectly.</p>
  
  <blockquote>
    <p>the path and permissions are already reviewed</p>
  </blockquote>
  
  <p>Any idea what might be happening?</p>