I'm working on a little script and I found another solution like the one I came up with use this line here:
for i in *; do
What exactly does the *;
do/mean here? I'm used to seeing $
variables.
for i in *; do
The *
here is the filename globbing character that matches all (non-hidden) names in the current directory.
In each iteration of the loop, the variable i
will take the value of each of the names matching *
in turn.
The ;
after the *
(as in most other places) may be replaced by a newline:
for i in *
do
Per Confused about the behavior of asterisk in ls command
Asterisk expands before it gets to the [...your...] command
So you are passing all the files matching your pattern *
to for