[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Bash globbing files only?



Hi!

> | But in this case I
> | need to do my script with bash and it seems that although globbing
> for
> | directories is trivial ( */ ) there is no similar pattern to match
> | files. Oh, well, I guess I'll need to waste some CPU cycles and
> launch
> | find everytime I need to know file names in the current directory.
> 
> Gah! No!
> 
>   files=
>   for f in *
>   do [ -f "$f" ] && files="$files $f"
>   done
>   ... do stuff with $files ...
> 
> If you've got to deal with filenames with whitespace in them you need
> to be trickier.

Thanks, I'll be using this one.

PS. A hard headed zsh user would continue to complain that there's no
way to differ between files and links in bash without find but I won't
go into that :)

Cheers!




 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]