本文介绍了有哪些替代方案可用于"readlink -e“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了一个 makefile,为了创建一个库,我使用了一个看起来像这样的 .pc 文件
I use a makefile which in order to create a library uses a .pc file which looks like this
current_path=`readlink -e .`
cat > lib/libmy.pc << EOM
prefix=$current_path
includedir=\${prefix}/inc
libdir=\${prefix}/lib
Name: my
Description: My library
Version: 1.0
Cflags: -I\${includedir}
Libs: -L\${libdir} -lmy
Libs.private: -lm
EOM
问题是在Mac上-e标志不起作用(即使我安装了coreutils).我有替换标志的方法吗?
The problem is that on mac the -e flag doesn't work (even I installed coreutils). I there a method to replace the flag?
推荐答案
我能找到的最方便的方法:
The most portable way I could find:
current_path=`python -c "import os; print(os.path.abspath('${MY_AWESOME_PATH}'))"`
在您的情况下:
current_path=`python -c "import os; print(os.path.abspath('.'))"`
这篇关于有哪些替代方案可用于"readlink -e“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!