I am not sure if this was the proper place to post this, none-the-less: I am developing a script to negative match git branches, however when this part was run, it tried to get HTTP headers....can someone explain how this is happening?
test.sh
#!/bin/bash
array_not_contains()
{
local array="$1[@]"
local seeking=$2
local in=0
for element in "${!array}"; do
echo $element #Commenting out this echo will stop it from fetching headers
if [[ $element =~ $seeking ]]; then
in=1
break
fi
done
return $in
}
exclude=() #array that will exclude the following matches from deletion
exclude+=(HEAD)
exclude+=(master)
exclude+=(develop)
exclude+=(example.*)
if $(array_not_contains exclude $1); then
echo "win"
else
echo "fail"
fi
Running it like this: ./test.sh bob will return headers