Not sure why this script kept getting a syntax error on my CI machine.
if [ -d "$ws" ]; then
if $condition; then
echo "first condition"
elif $second_condition; then
ls -al
shopt -s extglob
rm -rf !(".repo")
ls -al
$[/myResource/ec.perl] $[/myResource/PWToolRootLocationFull]SetProperty.pl $[/myParent/parent.workflow.path]/builds/$[/myParent/variant.id]/is.repo.preserved "true"
else
echo "else"
fi
fi
syntax error near unexpected token `('
I've tried
rm -rf !(.repo)
rm -rf "!(.repo)"
rm -rf !\(.repo\)
rm -rf !"(.repo)"
None of them are working.
shopt -s extglobis missing.shinstead ofbash, but then you'd probably get a "shopt: not found" error first. The$[...]syntax looks odd: that's bash deprecated syntax for arithmetic expansion -- does it have some kind of special meaning in your CI pipeline?shopt -s extglob, thenrm -rf -- !(*.repo)will delete anything in the current directory that doesn't end in.repo.