In the script it reads:
rm -v !\(*.yaml\) ;
this produces rm: cannot remove '!(*.yaml)': No such file or directory, but works fine in the command line.
Have tried escaping in various ways:
`\rm -v !\(\**.yaml\)` ;\
`
this produces
rm: cannot remove '!\(*.yaml\"\)`
"\!\(\*.yaml\yaml)"': No such file or directory
but works fine in the command line. Have tried escaping in various ways:
'\!\(\*.yaml\)'
`\!\(\*.yaml\)`
`!\(*.yaml\"\)`
"\!\(\*.yaml\)"
Can't seem to figure out the appropriate escape sequence, I simply don't understand. Escaping the brackets was my first step. Then trying to escape the !, then the *. Also tried no escaping, using back-ticks but I got the error "rm missing operand". Im a little stumped. Have been at it for about an hour - just "rm everything not yaml"... Can anyone perhaps spot the error/suggest a fix?
Many thanks,
P.S: HaveI have also tried #!/bin/sh and #!/bin/bash. Thought it would maybe have some effect.