RE: test for directory

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

 



90% of the time it doesn't matter, but yes Dave's way is less IO intensive. 

Rob Marti

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Dave Ihnat
Sent: Tuesday, August 18, 2009 8:44 AM
To: General Red Hat Linux discussion list
Subject: Re: test for directory

On Tue, Aug 18, 2009 at 06:41:30AM -0700, Yong Huang wrote:
> > Or, maybe less expensive:
> > 
> >   if [ \( -d /etc \) -a \( -d /home \) ]; then echo "Yes."; fi

> Can you explain why it's less expensive?

When you use a bracket, you're spawning a subshell.

Cheers,
--
	Dave Ihnat
	dihnat@xxxxxxxxxx

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux