Re: test for directory

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

 



also u can do:

if  test -d /home/ && test -d /var  ; then echo yes; else echo no; fi


Regards,
Zoran




Dave Ihnat <dihnat@xxxxxxxxxx> 
 
Enviado por: redhat-list-bounces@xxxxxxxxxx
18/08/2009 16:26
Por favor, responda a
General Red Hat Linux discussion list <redhat-list@xxxxxxxxxx>


Para
General Red Hat Linux discussion list <redhat-list@xxxxxxxxxx>
cc

Asunto
Re: test for directory






On Tue, Aug 18, 2009 at 06:03:14PM +0400, TYURIN Aleksey wrote:
> 
> If [ -d /path/a -a -d /path/b]

I'd suggest being careful posting help to the list before checking
it--many who ask for aid won't catch syntax errors.  That snippet would
fail with the right bracket snuggled up against the 'b'.

Also, it's always much safer to specify multiple tests with enclosing
escaped brackets to guarantee proper association, e.g., for your
example:

  if [ \( -d /path/a \) -a \( -d /path/b \) ]

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