简体   繁体   English

终端错误:cp:非法选项

[英]terminal error: cp: illegal option

these terminal commands are written for linux. 这些终端命令是为linux编写的。 can they be translated to mac? 可以将它们翻译成mac吗?

#!/bin/sh
cp --preserve=links libleveldb.* /usr/local/lib
cp -r include/leveldb /usr/local/include/
ldconfig

this is the error I am getting: 这是我得到的错误:

cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
./try.sh: line 4: ldconfig: command not found

You don't have --preserve option in Mac version of cp . Mac版本的cp没有--preserve选项。 Use -p option instead (see man page ) 请改用-p选项(请参见手册页

Sometimes replacing Mac coreutils with the GNU ones may be a good solution. 有时用GNU替换Mac coreutils可能是一个很好的解决方案。 See this thread to learn more about installing GNU coreutils on your Mac. 请参阅此线程以了解有关在Mac上安装GNU coreutils的更多信息。

Also, the ldconfig won't work on Mac either. 另外, ldconfig也不能在Mac上运行。 See this discussion to find an alternative. 请参阅此讨论以找到替代方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM