In Linux BASH shell, you can use curly brace {} to represent a set of possible values in an array. For example,
touch abc{1,2,3,4}
This will be equivalent to four command as follows and as a result, 4 files will be generated.
touch abc1
touch abc2
touch abc3
touch abc4
Please note that there should not be spaces inside the curly braces. For example,
~$ echo abc{1, 2, 3, 4}
abc{1, 2, 3, 4}
However,
~$ echo abc{" 1"," 2"," 3"," 4"}
abc 1 abc 2 abc 3 abc 4
This is useful, if you want to make several folders under a specific directory, you can use this elegant solution:
mkdir /some/dir/{a,b,c,d}
This will create four commands as:
mkdir /some/dir/a
mkdir /some/dir/b
mkdir /some/dir/c
mkdir /some/dir/d
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: PHP Script to Test Crontab
Next Post: CloudFlare supports SSL