![]() |
In a shell script.. how do I test if any *.php exist?
if test -e *.php; is invalid so how do you do that?
|
my techs arent around, but if you mean search for .php the comman is locate *.php
|
not to search.. to check if any exists and branch in the script based on it.
|
Maybe something like...
if [ "`ls *.php`X" = "X" ]; then # no *.php fi That may print out an error to stderr if there's no files. Not sure. I wouldn't use 'locate' since that checks the locate database (which is only rebuilt periodically) rather than looking at actual (current) directory entries. |
if [ -f *.php ]; then echo "PHP files present"; fi
Mind you, the spaces need to be there. Also, you could do: if [ ! -f *.php ]; then echo "no PHP files present"; fi |
Quote:
and the host thinks the problem is you. :1orglaugh Just a WILD guess here. |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
All times are GMT -7. The time now is 06:53 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc