[CentOS] stupid bash question

Craig White craig.white at ttiltd.com
Thu Aug 16 16:48:16 UTC 2012


On Aug 15, 2012, at 5:11 PM, fred smith wrote:

> how about something (seemingly simple) like this:
> 
> find out how many there are:
> 
> 	count=`ls * | grep -c .MOV$`
> 
> then diagnose the result:
> 
> 	if [ $count -ge 1 ]
> 		then
> 		do your stuff here
> 	else
> 		echo oops. nothing to do!
> 	fi
> 
> of course, there are pitfalls... we're asuming that there are only FILES
> that would match the pattern ".MOV", no directories.
----
very effective for my purposes, thanks.

Craig



More information about the CentOS mailing list