Often, I use parameter expansion on the command-line, such as
cp a.{ext1,ext2}
which is expands to
cp a.ext1 a.ext2
However, in many cases I do not use cp
, but another tool, let's call it cat
, and I would do some output redirection, like
cat a.ext1 > a.ext2
In my case a
can vary, or be quite long, so I would like to be able to use some sort of brace expansion, that at least needs only one occurrence of a
in the one-liner. How can I obtain that?
I am specifically using
$ bash --version
GNU bash, version 3.2.51(1)
but answers using other shells are also appreciated.