What does the * in this line do/indicate?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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.
bash shell-script
add a comment |Â
up vote
0
down vote
favorite
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.
bash shell-script
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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.
bash shell-script
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.
bash shell-script
edited Jan 15 at 17:23
Stéphane Chazelas
281k53518849
281k53518849
asked Jan 15 at 16:52
Saith
103
103
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
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
1
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
add a comment |Â
up vote
1
down vote
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
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
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
1
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
add a comment |Â
up vote
5
down vote
accepted
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
1
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
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
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
edited Jan 15 at 17:09
answered Jan 15 at 16:58
Kusalananda
103k13203321
103k13203321
1
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
add a comment |Â
1
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
1
1
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
@Saith then you should accept the answer!
â Putnik
Jan 15 at 20:53
add a comment |Â
up vote
1
down vote
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
add a comment |Â
up vote
1
down vote
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
add a comment |Â
up vote
1
down vote
up vote
1
down vote
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
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
answered Jan 15 at 16:58
WEBjuju
410211
410211
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f417290%2fwhat-does-the-in-this-line-do-indicate%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password