What is the difference between cp fileA fileB
and cp -- fileA fileB
in Linux?
Asked
Active
Viewed 345 times
1
1 Answers
3
--
specifies the end of options. In your specific example this shouldn't make a difference but if you were using filename globbing such as: cp * fileB
to find a file and you had a file in your directory named -R
for example your command could potentially be:
cp -R dirA fileB
Which obviously wouldn't be the desired outcome. This is especially important when using commands like rm
.

jesse_b
- 37,005