Advertisement

bash scripting question

Started by January 16, 2005 01:47 PM
4 comments, last by Genjix 19 years, 9 months ago
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.
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.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
Advertisement
if file exists{	if files date > someotherfile	{		do stuff	}}

sorry, but I don't really know how to phrase it.
If a file is older than another file, perform some actions?
In case you were wondering what to put in your next christian game; don't ask me, because I'm an atheist, an infidel, and all in all an antitheist. If that doesn't bother you, visit my site that has all kinds of small utilities and widgets.
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  fifi

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]

This topic is closed to new replies.

Advertisement