I am routinely editing shell scripts (bash). One of them gets quarantined whenever I modify it. When I run it, I get the error:

    $ ./opg.sh 
    -bash: ./opg.sh: /bin/bash: bad interpreter: Operation not permitted

The solution is to reset the quarantine flag. Then the script runs:

    $ xattr -d com.apple.quarantine opg.sh
    $ ./opg.sh 
    Missing or invalid option ...
    Must be one of: start, stop, status, check, or log

My question: why is that ? I have tons of other bash scripts, in the same directory and in other directories. I can edit them and they do not get quarantined. Only this one does. Any idea why ?

It does not seem to be related to the editor I use (I use bbedit and textedit - same effect).

I guess it must be something to do with the content of the script. But I can't see what ...