if test -e *.php; is invalid so how do you do that?
In a shell script.. how do I test if any *.php exist?
Collapse
X
-
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.Comment
-
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"; fiNew Program! http://www.pixelbucks.com | ICQ: 369055569Comment
-
Comment
-
Comment
-
sounds like you just need this ... http://www.amazon.com/Linux-Command-.../dp/047025128Xbest host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself
Comment
-
Comment





Comment