bash
shopt -s nullglob dotglob
files=("$dir"/*.zip)
((${#files[@])) && printf '%s\n' "${files[@]}"
shopt -u nullglob dotglob # if needed
zsh
files=($dir/*.zip(ND))
(($#files)) && printf '%s\n' $files
fish
set files $dir/.*.zip $dir/*.zip
if count $files > /dev/null
printf '%s\n' $files
end
(cuidado, omitiria um arquivo chamado .zip
(ao contrário das outras soluções dadas aqui)).
ksh93
FIGNORE='@(.|..)'
files=(~(N)"$dir"/*.zip)
((${#files[@])) && printf '%s\n' "${files[@]}"
unset FIGNORE # if needed
yash
set -o dot-glob -o null-glop
files=("$dir"/*.zip)
[ "${files[#]}" -gt 0 ] && printf '%s\n' "$files"
set +o got-glob +o null-glob # if needed
POSIXly
export LC_ALL=C
set -- "$dir"/[*].zip "$dir"/*.zip
case ${1##*/}${2##*/} in
'[*].zip*.zip') shift 2
esac
set -- "$dir"/.[*].zip "$dir"/.*.zip "$@"
case ${1##*/}${2##*/} in
'.[*].zip.*.zip') shift 2
esac
[ "$#" -gt 0 ] && printf '%s\n' "$@"