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 *
?
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 *
?
To avoid the
*
, you can try something likeTried now on an empty directory, no output given...
Set nullglob
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:Aleks-Daniel Jakimenko said "Do not parse ls". Which is good, so how about this if we don't want to change nullglob: