Rodion Iskhakov
Rodion Iskhakov

Reputation: 157

What is * .* in for loop in Bash?

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

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

Upvotes: 1

Views: 46

Answers (1)

Andy Lester
Andy Lester

Reputation: 93725

* 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.

Upvotes: 1

Related Questions