makefile - 查找:路径必须先于表达式: `1'

标签 makefile find

我正在尝试运行一个文件调用 buildAll.sh,它应该从基准生成二进制文件并将它们全部放入顶层目录。

#!/bin/sh

find . -d 1 -type d \( ! -name . \) -exec bash -c "cd {} && make clean && make && cp main.bin ../{}.bin && make clean" \;

但是,我得到一个错误:

find: paths must precede expression: `1'

我不确定该命令是如何工作的,以及如何修复它。

我在 Ubuntu 上运行了这个。 谢谢

最佳答案

当在命令行上发现杂散参数时会显示该错误,在本例中为 1,如 -d(即 -depth) 不接受参数。但是,您似乎根本不需要在这里找到 find

for dir in ./*/; do
  make -C "$dir" clean &&
  make -C "$dir" &&
  cp "$dir/main.bin" "$dir.bin" &&
  make -C "$dir" clean
done

关于makefile - 查找:路径必须先于表达式: `1',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56114856/

相关文章:

bash - 连接 find -print0 和 xargs -0

makefile - 从 Makefile 中的路径名中获取子字符串

perl - 图片::Magick 安装错误 127

vba - Excel-VBA : Find and Replace and Date Formatting from String

java - 如何在 Java 中替换字符串的一部分?

linux - 在日期范围内创建的所有文件中进行 Grep

bash - Makefile 的基于任务的语言替代方案

c - 忽略一个特定文件的错误

c - 了解 map 文件,优化大小

powershell - PowerShell 的正则表达式无法与/n(换行符)一起使用