Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add for using brace or nested brace expansion #58

Open
khanhnt2 opened this issue May 13, 2017 · 1 comment
Open

Add for using brace or nested brace expansion #58

khanhnt2 opened this issue May 13, 2017 · 1 comment

Comments

@khanhnt2
Copy link

There is an other use of for, it's very useful in some case

for char in {a..z}; do
    echo$ char
done

It will be print a b c ... x y z
or

for i in {{a..m},{0..9},{n..z}}; do # don't have any space between commas
    echo $i
done

It will be print a b c ... k l m 0 1 2 ... 7 8 9 n o u ... x y z

@ghost
Copy link

ghost commented May 14, 2023

For anyone like me seeing this while searching through GitHub, this is not a feature of the for loop itself, but a general feature called brace expansion. This is useful in a great many ways, such as during file operations with glob filename pattern matching and in the situation posted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant