【发布时间】:2012-03-10 07:42:30
【问题描述】:
我有一个如下所示的 bash 脚本:
#!/bin/bash
FILES=public_html/*.php # */ stupid syntax highlighter!
for f in $FILES
do
echo "Processing $f file..."
# take action on each file.
done
现在我需要它遍历 public_html 中的所有子目录,所以它应该运行:
/public_html/index.php
/public_html/forums/status.php
/public_html/really/deep/file/in/many/sub/dirs/here.php
为了做到这一点,我应该将FILES=public_html/*.php 更改为什么?
我还需要检查以确保至少有一个文件,否则它会打印出来
Processing *.php file...
【问题讨论】: