test for directory

Marti, Rob RJM002 at shsu.edu
Tue Aug 18 13:47:25 UTC 2009


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 at redhat.com [mailto:redhat-list-bounces at redhat.com] 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 at dminet.com

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




More information about the redhat-list mailing list