Linux - Bash Brace Expansion
Brace expansion is enabled via the "set -B" command and the "-B" command line option to the shell and disabled via "set +B" and "+B" on the command line.
Some examples and what they expand to:
{aa,bb,cc,dd} => aa bb cc dd
{0..12} => 0 1 2 3 4 5 6 7 8 9 10 11 12
{3..-2} => 3 2 1 0 -1 -2
{a..g} => a b c d e f g
{g..a} => g f e d c b a
a{0..3}b => a0b a1b a2b a3b
{a,b{1..3},c} => a b1 b2 b3 c
for i in {0..19}
do
echo $i
done
for i in {a..z}
do
echo $i
done
# rm /a/long/path/foo /a/long/path/bar
# rm /a/long/path/{foo,bar}
Some examples and what they expand to:
{aa,bb,cc,dd} => aa bb cc dd
{0..12} => 0 1 2 3 4 5 6 7 8 9 10 11 12
{3..-2} => 3 2 1 0 -1 -2
{a..g} => a b c d e f g
{g..a} => g f e d c b a
a{0..3}b => a0b a1b a2b a3b
{a,b{1..3},c} => a b1 b2 b3 c
for i in {0..19}
do
echo $i
done
for i in {a..z}
do
echo $i
done
# rm /a/long/path/foo /a/long/path/bar
# rm /a/long/path/{foo,bar}
Comments
Post a Comment