Re: test empty dir

2003-03-07 Thread Anand Buddhdev
On Fri, Mar 07, 2003 at 11:12:07AM -, Zhi Cheng Wang wrote: > this seems a very good test, but the system says "[: too may arguments" Ouch. Sorry, I forgot the quotes. Thanks to everyone who spotted this and responded while I was on the bus :) > > how can i test if a directory is empty? at t

Re: test empty dir

2003-03-07 Thread Cameron Simpson
On 11:12 07 Mar 2003, Zhi Cheng Wang <[EMAIL PROTECTED]> wrote: |From: Anand Buddhdev [mailto:[EMAIL PROTECTED] |> On Fri, Mar 07, 2003 at 08:52:56AM -, Zhi Cheng Wang wrote: |> > how can i test if a directory is empty? at the moment i use the following method: |> > |> > ls -l /dirname | grep

Re: test empty dir

2003-03-07 Thread Robert P. J. Day
On Fri, 7 Mar 2003, Mike Reed wrote: > He just missed some double quotes. > > if [ -z "$(ls -A dirname)" ]; then echo empty; fi > > I prefer the $(shell command) syntax rather than the `shell command`. I > find it easier to read. > I believe (someone tell me if I'm wrong) that it is now part o

Re: test empty dir

2003-03-07 Thread Robert P. J. Day
On Fri, 7 Mar 2003, Mike Reed wrote: > He just missed some double quotes. > > if [ -z "$(ls -A dirname)" ]; then echo empty; fi > > I prefer the $(shell command) syntax rather than the `shell command`. I > find it easier to read. > I believe (someone tell me if I'm wrong) that it is now part o

Re: test empty dir

2003-03-07 Thread Mike Reed
mailto:[EMAIL PROTECTED]] Sent: 07 March 2003 09:55 To: [EMAIL PROTECTED] Subject: Re: test empty dir On Fri, Mar 07, 2003 at 08:52:56AM -, Zhi Cheng Wang wrote: dear gurus how can i test if a directory is empty? at the moment i use the following method: ls -l /dirname | grep "

RE: test empty dir

2003-03-07 Thread Zhi Cheng Wang
this seems a very good test, but the system says "[: too may arguments" -Original Message- From: Anand Buddhdev [mailto:[EMAIL PROTECTED] Sent: 07 March 2003 09:55 To: [EMAIL PROTECTED] Subject: Re: test empty dir On Fri, Mar 07, 2003 at 08:52:56AM -, Zhi Cheng Wang wrot

Re: test empty dir

2003-03-07 Thread Anand Buddhdev
On Fri, Mar 07, 2003 at 08:52:56AM -, Zhi Cheng Wang wrote: > dear gurus > > how can i test if a directory is empty? at the moment i use the following method: > > ls -l /dirname | grep "total 0" > if [ $? ] then This is not a good test. "ls -l" will not reveal dot-files. Use "ls -A" w

test empty dir

2003-03-07 Thread Zhi Cheng Wang
dear gurus how can i test if a directory is empty? at the moment i use the following method: ls -l /dirname | grep "total 0" if [ $? ] then but I think it is ugly, any pretty way? ... Cheng This email is confidential and intend