- 1Introduction
- 2Bourne Shell
- 3Bourne Again Shell
- 4Reserved Words
- 5Built-Ins
- 6Brace Expansion
- 7Pipeline Subprocesses
- 8(Preliminary) Conclusion
Brace Expansion
The Bash feature „brace expansion“ is not present in sh. For example, when executing the following code in sh and in bash:
echo foo{1,2,3}
In sh, the output will be literal:
foo{1,2,3}
In bash it will be expanded to
foo1 foo2 foo3
Advice
To avoid brace expansion, the string can be put in quotes:
echo 'foo{1,2,3}'
Alternatively, the special characters in the string can be escaped:
echo foo\{1,2,3\}