【问题标题】:/bin/sh: -c: line 0: unexpected EOF while looking for matching `"' while using dir() function in makefile/bin/sh:-c:第 0 行:在 makefile 中使用 dir() 函数查找匹配的“”时出现意外 EOF
【发布时间】:2017-01-13 09:26:35
【问题描述】:

我收到带引号的字符串路径的 tis 错误 我有像 PATH_VAR 这样的路径变量,我想要输出 C:/test/tools 所以下面是配方

PATH_VAR = "C:/test/tools/compiler_name.exe"
.PHONY : TEST
TEST: 
    echo $(dir $(PATH_VAR))

但我收到如下错误

echo "C:/test/tools/
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [TEST] Error 1

【问题讨论】:

    标签: bash makefile


    【解决方案1】:

    $(dir $(arg)) 电话 提取 arg 的值直到并包括最后一个 /。所以价值 $(dir $(PATH_VAR)) = $(dir "C:/test/tools/compiler_name.exe") 是:

    "C:/test/tools/
    

    这是一个未终止的带引号的字符串。删除 "C:/test/tools/compiler_name.exe" 周围的引号

    【讨论】:

    • 谢谢 Mike 我明白了,请告诉我如何获得“C:/test/build_tool”
    • @Vicky 在 Stackoverflow 上一次一个问题。请参阅What should I do when someone answers my question?,如果您还有其他无法自己解决的问题,请提出新问题。
    猜你喜欢
    • 2020-06-14
    • 2018-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-06
    • 2020-12-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多