How to check there are no html files in current directory?

Posted by kev on Super User See other posts from Super User or by kev
Published on 2012-04-08T15:29:09Z Indexed on 2012/04/08 17:34 UTC
Read the original article Hit count: 142

Filed under:
|

I have a script which will download html files into current directory.
Then it'll generate a report based on these html files.
At last, it'll delete all these html files.
So, when I run this script, I want to make sure there is no html files in current dir.

This is what I got:

if ls *.html >/dev/null 2>&1; then
    echo 'clear HTML files first'
    exit
fi

Is there any easy way to check?

© Super User or respective owner

Related posts about bash

Related posts about script