On Fri, Dec 11, 2009 at 04:16:13PM +0000, Marc Herbert wrote:
> In case anyone is interested my winner (so far) is:
>
> exists()
> {
> [ -e "$1" -o -L "$1" ]
> }
>
> if exists foo/*; then
> for f in foo/*; do
> ...
> done
> fiWhat if there's a subdirectory or something and you'd like to skip it? for f in foo/*; do test -f "$f" || continue ... done Hence my explanations at the bottom of http://mywiki.wooledge.org/BashFAQ/004
