cp: invalid option -- 'o'
Solution 1
You can safely remove the -o option. Btw, is $OPENSSL_VERSION set?
Solution 2
That's a typo. There is no implementation of cp
that has a -o
option on any Unix that I know of. My guess is that this option may safely be removed.
It may be that they meant cp -p
(preserve mode, timestamp and ownership when used with GNU cp
and others), or cp -i
for interactive prompting in case the file already exists.
They are obviously using GNU cp
though, since they intermingle operands with options. Ordinary tools usually stop parsing the command line at the first non-option, but GNU tools will try to be smart.
Related videos on Youtube
Adhy Satya
Updated on September 18, 2022Comments
-
Adhy Satya almost 2 years
I'm following an installation script on GitHub and one of the steps is:
cp sources/openssl/1.0.1p/Android.mk -o sources/openssl/$OPENSSL_VERSION/Android.mk
But my terminal threw an error
cp: invalid option -- 'o'
I checked
man cp
on my Ubuntu, and there's no option-o
. Is this a MAC OS thing? What doescp -o
stand for?-
Admin over 6 yearsI'm not sure where the -o came from but I am presuming that it isn't needed and the copy is simply copying from one source destination to a source directory
-
-
Adhy Satya over 6 yearsThanks. Yes, it is set (OPENSSL_VERSION=1.0.2h)
-
Stéphane Chazelas over 6 yearsAnyway,
cp file -o dir
is meant to copy thefile
and-o
files todir
. Only GNU (or GNU-like like busybox)cp
would take that-o
as an option (and only when$POSIXLY_CORRECT
is not in the environment) -
JdeBP over 6 yearsPossibly it was confusion with the common
curl
…-o
. But this is all guesswork. Only Lei Pi can really explain. -
user000001 over 6 years@StéphaneChazelas On ubuntu
--one-file-system
option is abbreviated to-x
-
Stéphane Chazelas over 6 years@user000001, yes, but
--o
(or--on
, or--one
...) would also work (note the double dash) -
user000001 over 6 years@StéphaneChazelas: Ah, I missed the second dash. It's really cool that you can abbreviate long options like that, I hadn't realized it even after many years of using linux. Thanks for letting me know :)
-
Kusalananda over 6 years@user000001 If you ever write a script (or documentation), don't abbreviate the options though. It makes it unnecessarily hard to understand.