Archive for August, 2009
Bash brace expansion to expand arguments
Aug 1st
Braces can be used to expand arguments in bash. Bash expands a list of strings separated by commas with in braces to a list of strings separated by spaces. Look at the simple example below:
[neo@techpulp ~]# echo {red,green,white}
red green white
[neo@techpulp ~]#
The above example may not be really useful but you can use bash to expand the arguments by adding prefix or suffix to the braces as shown below to generate expanded arguments. Note that there should not be any space between suffix/prefix and the start/end bracket. Otherwise it is considered as a separate list.
[neo@techpulp ~]# echo {red,green,white}ball
redball More > 

Recent Comments