说我有这个文件夹结构:
a/b/test/
a/b/c/test/
a/b/d/test/
我想编写一个返回以下内容的bash脚本:
a/b/test/
a/b/d/test/
目前,我正在尝试find
find . -regex ".*/test"
,但这会返回所有内容。
find . -regex "[^c]"
这什么都不返回
我想要的是find . -regex "(?!c)"
之类的东西,但是我无法在bash中使用回溯
我也可以做类似的事情
if [[${pwd} == *"c"*]]; then
dont include in output
fi
但是在最后一个示例中,我不确定这在Linux和Windows上是否都可以兼容,并且/或者这是否是“好”方式。
你会怎么做?