![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
In a shell script.. how do I test if any *.php exist?
if test -e *.php; is invalid so how do you do that?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
aka K-Man
Industry Role:
Join Date: Oct 2001
Location: The Gutter
Posts: 29,282
|
my techs arent around, but if you mean search for .php the comman is locate *.php
__________________
Crypto HODLr Crypto mining Angel investor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
not to search.. to check if any exists and branch in the script based on it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Too lazy to set a custom title
Join Date: Mar 2002
Location: Australia
Posts: 17,393
|
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Nov 2008
Posts: 496
|
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
__________________
New Program! http://www.pixelbucks.com | ICQ: 369055569 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Mar 2007
Posts: 7,771
|
Let me guess......you got hacked and you have cheap hosting
and the host thinks the problem is you. ![]() Just a WILD guess here.
__________________
![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Too lazy to set a custom title
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
So Fucking What
Industry Role:
Join Date: Jul 2006
Posts: 17,189
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
So Fucking What
Industry Role:
Join Date: Jul 2006
Posts: 17,189
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Too lazy to set a custom title
Join Date: Mar 2002
Location: Australia
Posts: 17,393
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |