在xonsh中,我可以运行这样的find命令:
find @(str(path)) -iname "log.txt"其中path是pathlib.Path对象。
但是,我不明白如何在-exec和-execdir选项上使用find
find @(str(path)) -iname "log.txt" -execdir pwd {} \;这将导致错误:
SyntaxError: <xonsh-code>:1:5: ('code: @(',)我查看了教程- xonsh 0.10.1.dev5.dev5文档并尝试了@$(.)还有许多其他的变体都没有成功。
编辑:此版本
find @(str(path)) -iname "log.txt" -execdir pwd '{}' \;给出此错误:
find: missing argument to `-execdir'发布于 2022-05-06 08:13:56
只是在这里添加答案,以供将来参考:
这个bash
find ~/.local/lib/python3.8/ -iname "*ygments*pyc" -exec ls -ahtlr {} \;变成了这个xonsh .
find ~/.local/lib/python3.8 -iname "*ygments*pyc" -exec ls -ahltr "{}" ";"虽然这似乎也有效:-D:
for i in !(find ~/.local/lib/python3.8 -iname "*ygments*pyc"):
ls -ahtlr @(i.strip())https://stackoverflow.com/questions/68823118
复制相似问题