Given two files named test1 and test2, I would like to copy them to test1.bak and test2.bak respectively.
In windows, I can do a simple regex copy like this:
copy test* test*.bak
In Linux the command
cp test* test*.bak
gives me the message:
cp: target `test*.bak' is not a directory
My guess is that this is becasue "*" is a vaild character for a file name in linux.
> touch \* > ls * test1 test2
So I tried:
cp test\* test\*.bak
But I got the same message.
It seems to me there must be a simple way to do this in Linux since it relies much more strongly on the command line than Windows.
Is there a simple way without having to learn something like sed?
If you're posting for help, please include the following details, so that we can help you more efficiently:
Questions are encouraged. If you fix the problem yourself, please post your solution, so that others can also learn.
There's a great list of introductory links here - thanks to SCSweeps.
Other subreddits you may like:
Does this sidebar need an addition or correction? Tell me here