Home > Software engineering >  What is * .* in for loop in Bash?
What is * .* in for loop in Bash?

Time:02-23

cd /var/spool/myname
for i in * .*;
do
    ...
done

What is * .*? As I understand, for i in * .* = for i in /var/spool/myname.

CodePudding user response:

* is all the files in the directory except those starting with .. The .* is all the files that start with ..

Basically it's trying to get every file in the directory. One potential problem is that .* will also return . which is the current directory and .. which is the parent directory.

  •  Tags:  
  • bash
  • Related