我试图做的是(这是伪代码):
for txt in $(some fancy command ./*.txt); do
some command here $txt
您可以使用find
:
find /path -type f -name "*.txt" | while read txt; do
echo "$txt"; # Do something else
done
使用该-exec
选项find
:
find /usr/share/wordlists/*/* -type f -name '*.txt' -exec yourScript {} \;
尝试
find . | grep ".txt" | xargs -I script.sh {}
find 返回目录中的所有文件。grep 仅选择 .txt 文件,xargs 将文件作为参数发送到 script.sh