The tag has no wiki summary.

learn more… | top users | synonyms

7
votes
2answers
531 views

How can I use $var in a shell brace expansion of a sequence?

I want to use $var in a shell brace expansion with a range, in bash. Simply putting {$var1..$var2} doesn't work, so I went "lateral"... The following works, but it's a bit kludgey. # remove the ...
28
votes
5answers
2k views

When do you use brace expansion?

I understand what brace expansion is, but I don't know how best to use it. When do you use it? Please teach me some convenient and remarkable examples if you have your own tip.
7
votes
5answers
6k views

How to create a sequence with leading zeroes using brace expansion

When I use the following, I get a result as expected: $ echo {8..10} 8 9 10 How can I use this brace expansion in an easy way, to get the following output? $ echo {8..10} 08 09 10 I now that ...
4
votes
1answer
115 views

`seq` and bash brace expansion failing

IINM my system is failing when bashing for i in {0..10000000}; # Seven zeroes. do false; done # `bash` exited and its `tmux` pane/window was closed. or for i in $(seq 0 10000000); # ...
2
votes
1answer
99 views

cp : short way of copying

I don't remember exactly but there was either cp or mv command which I was able to do something like this with: cp file{.cpp, .cpp.org} Which would copy file.cpp and make a copy named file.cpp.org. ...
4
votes
2answers
81 views

Brace compression

I love brace expansion (e.g. rm file.{0..5}). I find it a lot easier to read than the expanded version. Is there a quick and easy way of doing the opposite? For example given the input ...
1
vote
2answers
56 views

How to combine arithmetic expansion and brace expansion? [duplicate]

Can peoples combine arithmetic expansion and brace expansion? $ for i in {$((1 + 1))..5}; do echo $i; done; {2..5} $ echo "bash laughs at me"
1
vote
3answers
148 views

Why brace expansion not supported?

Do I have to do any configuration to start brace expansion? When I run mkdir {1..10}, it just creates a dir naming {1..10}.
1
vote
2answers
251 views

brace expansion other commands besides mkdir?

Found this nifty lifehacking gem to create multiple directories: http://unix.stackexchange.com/a/640/7768 I was wondering if there are other commands support brace expansion?