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

Re: Checking if directory is empty in postrm



Antti-Juhani Kaijanaho <gaia@iki.fi> wrote:
> ls -1 | grep .\*

Actually, I'd recommend:

ls -A | grep -q .

Reasons:

(1) You don't care if the display is single or multi-column
	Thus, the -1 option of ls is useless
(2) hidden files would still mean the directory is not empty
	Thus, you want ls to use the -A option
(3) You don't care about how many characters are on a line
	Thus you don't need the * wildcard
(4) You have no particular use for the directory listing
	Thus you want grep to use its -q option

-- 
Raul


Reply to: