, , bash :
shopt extglob
echo !(*/)
But note that this is actually what corresponds to "dislike directories."
It will still correspond to dangling symbolic links, symbolic links pointing to non-directories, device nodes, fifos, etc.
It will not match symbolic links pointing to directories.
If you want to iterate over normal files and no more, use find -maxdepth 1 -type f.
A safe and reliable way to use it is as follows:
find -maxdepth 1 -type f -print0 | while read -d $'\0' file; do
printf "%s\n" "$file"
done
source
share