Suppose I want to copy (or for that matter, perform any operation on) two files, dir1/dir2/foo.abc
and dir1/dir2/bar.xyz
, to the current directory. What I end up doing is this:
cp dir1/dir2/bar.xyz dir1/dir2/foo.abc .
Is there a less cumbersome way to do the same? I mean something like:
cp dir1/dir2/["bar.xyz", "foo.abc"] .
Best Answer
Yes - in fact very like that - but with braces rather than square brackets:
See brace expansion.