bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: best way to test for empty dir?


From: Antonio Macchi
Subject: Re: best way to test for empty dir?
Date: Fri, 11 Dec 2009 13:09:09 +0100
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

is_file()
{
    [ -f "$1" ]
}

is_file /path/to/dir/* || echo empty



test is redundant too

---

this could be another way to accomplish this

empty_dir()  {
  eval test \" $1/* \" == \"" $1/* "\";
}


(excluding invisible files...)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]