For example, try following command in an empty directory:
$ for i in *; do echo $i; done
*
Is there a way to suppress the printout of
Basic idea is use ls command, but if filename has space, ls
will split file name by space. In order to handle space in filename, you can do like this:
ls|while read i; do echo $i; done
Aleks-Daniel Jakimenko said "Do not parse ls". Which is good, so how about this if we don't want to change nullglob:
for i in *; do [ -e "$i" ] && echo $i; done