While reviewing someone's bash script, I ran into following command. My question is why "." is required for copying a file from one location to another? To me it seems unnecessary.

cp source/foo.xml destinaton/.
  • 6
    It is not required. – Tigger May 17 '17 at 3:41
  • 1
    A better question would be: Why does cp require two arguments when copy a file from another directory to current working directory? – hschou May 17 '17 at 6:26

The dot (.) is not required.

You can use the following syntax as well:

cp source/foo.xml destination/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.