Bourne to Bourne Again Shell Forward Compatibility

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:


In bash it will be expanded to

foo1 foo2 foo3


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\}