for file in .* *; do
test . = "$file" && continue
test .. = "$file" && continue
# if you just want real files, no symlinks
# test -L "$file" && continue
test -f "$file" || continue
test -s "$file" || continue
# here do what you want with what is left
done
将找到大小为 1 个或多个字节的文件
/searchdir
。仅 Shell,避免查找,不递归到子目录:
bash(对于未设置的 GLOBIGNORE):