test for directory

Yong Huang yong321 at yahoo.com
Tue Aug 18 13:41:30 UTC 2009


> On Tue, Aug 18, 2009 at 07:50:45AM -0500, Marti, Rob wrote:
> > [root at ab1-4-160 ~]# if [ -d /etc ] && [ -d /home ]; then echo "Yes."; fi
> > Yes.
> 
> Or, maybe less expensive:
> 
>   if [ \( -d /etc \) -a \( -d /home \) ]; then echo "Yes."; fi
> 
> Cheers,
> --
>     Dave Ihnat
>     dihnat at dminet.com

Dave,

Can you explain why it's less expensive?

Yong Huang


      




More information about the redhat-list mailing list