Jump to content
  • Advertisement
Sign in to follow this  
Genjix

bash scripting question

This topic is 4996 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have virtually no idea how to do this, and I have spent ages googling (I have tried).
	if [ fexist $1 ]; then
		if [ file_date $1 -gt $someotherfile ]; then
			# ...
		fi
	fi
Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Genjix
I have virtually no idea how to do this, and I have spent ages googling (I have tried).

if [ fexist $1 ]; then
if [ file_date $1 -gt $someotherfile ]; then
# ...
fi
fi

Thanks.


I might help if you explained what you are trying to do.

Share this post


Link to post
Share on other sites

if file exists
{
if files date > someotherfile
{
do stuff
}
}

sorry, but I don't really know how to phrase it.

Share this post


Link to post
Share on other sites
you could use the -nt or -ot for conditional expressions, i.e.


#file exist?
if [ -f $1 ]; then
if [ $1 -nt somefilename ]; then
#file is newer(based on modification date) than somefilename
fi
fi

Share this post


Link to post
Share on other sites

Oh WOW, simply amazing. Thanks :D. Didn't know that kind of stuff would be built into sh.



[Edited by - Genjix on January 16, 2005 6:52:37 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!