Does there exist a Bash equivalent to concatenation from the Plan 9 rc shell?

In the Plan 9 rc shell, one can write

echo (foo bar baz)^.c

to get

foo.c bar.c baz.c

or

echo (foo bar baz)^(.c .h .o)

to get

foo.c bar.h baz.o

Is there an equivalent to this in Bash? Specifically, is there a quicker way than `for f in foo bar baz; do echo $f.c; done` for the former, and does such a method exist for the latter?


You can use brace expansion for the first case:

$ echo {foo,bar,baz}.c
foo.c bar.c baz.c

(Note: this doesn't work for lists stored in variables, because brace expansion takes place before variable expansion.)

But I don't think there's a way to get it to zipper two lists together (like Plan 9's echo (foo bar baz)^(.c .h .o)). If you use brace expansion with two lists, it gives you all possible combinations:

$ echo {foo,bar,baz}{.c,.h,.o}
foo.c foo.h foo.o bar.c bar.h bar.o baz.c baz.h baz.o