In Bash, shopt -s nullglob will call globes that don't match any files to return an empty extension, not an identifier.
For POSIX, something like
case *.c in '*.c' ) echo no match ;; esac
with an obvious pathological exception that you might need separately to check if there is one match file whose name is literally *.c .
source share