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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-29-2009, 01:13 AM   #1
Tempest
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?
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-29-2009, 01:17 AM   #2
kmanrox
aka K-Man
 
kmanrox's Avatar
 
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
kmanrox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-29-2009, 01:27 AM   #3
Tempest
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.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-29-2009, 03:32 AM   #4
rowan
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.
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-29-2009, 08:38 AM   #5
Pixelbucks Eric
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
Pixelbucks Eric is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-29-2009, 10:33 AM   #6
sortie
Confirmed User
 
sortie's Avatar
 
Industry Role:
Join Date: Mar 2007
Posts: 7,771
Quote:
Originally Posted by Tempest View Post
if test -e *.php; is invalid so how do you do that?
Let me guess......you got hacked and you have cheap hosting
and the host thinks the problem is you.




Just a WILD guess here.
__________________
sortie is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2009, 01:20 AM   #7
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by sortie View Post
Let me guess......you got hacked and you have cheap hosting
and the host thinks the problem is you.



Just a WILD guess here.
No.. setting up a script to do an auto update of data files and need to do a cleanup.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2009, 01:30 AM   #8
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
Quote:
Originally Posted by sortie View Post
Let me guess......you got hacked and you have cheap hosting
and the host thinks the problem is you.




Just a WILD guess here.
what dick you are
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2009, 01:31 AM   #9
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
Quote:
Originally Posted by Tempest View Post
No.. setting up a script to do an auto update of data files and need to do a cleanup.
sounds like you just need this ... http://www.amazon.com/Linux-Command-.../dp/047025128X
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2009, 05:28 AM   #10
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by Pixelbucks Eric View Post
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
Might also need to quote "*.php"
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.