by quicklime · 5y ago · 0 comments
It was in a file called "find_files.sh", and the command it generated was something like:
> find .... -exec ... {}\;
The problem is that there's no whitespace between the {} and \; and this is rejected by both GNU and BSD find.
It might've just been a mistake that someone made while putting the landing page together. But if it was generated, then how?? I can't imagine there are many (if any) instances of "{}\;" in the training data, since it's not a valid invocation of the find command...
#!/bin/bash
# List all python source files which are more than 1KB and contain the word "copilot".
find . \
-name "\*.py" \
-size +1000 \
-exec grep -n copilot {}\;
[1] https://web.archive.org/web/20210701061847if_/https://copilo...- This lists the lines containing copilot instead of the files. You want `grep -l` to list the files.
- `--size +1000` finds files with over 1000 blocks. `--size +1000c` gets you files over 1KB.
- `-name "*.py"` only finds files literally named `.py`. To find files that match the glob `.py`, you would single quote it like `-name '*.py'`