#!/bin/bash

foo()
{
	shopt -s extglob
	mkdir /tmp/abacab
	cd /tmp/abacab || exit 1
	touch foo.gz bar.gz foo.txt
	echo !(*.gz)
}

foo

# bash -x chmod +x test.sh; ./test.sh 
# ./test.sh: line 9: syntax error near unexpected token `('
# ./test.sh: line 9: `    echo !(*.gz)'
