简体   繁体   中英

terminal error: cp: illegal option

these terminal commands are written for linux. can they be translated to 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 . Use -p option instead (see man page )

Sometimes replacing Mac coreutils with the GNU ones may be a good solution. See this thread to learn more about installing GNU coreutils on your Mac.

Also, the ldconfig won't work on Mac either. See this discussion to find an alternative.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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