grub-devel
[Top][All Lists]
Advanced

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

grub 'if' expression with 'or' operation


From: Loving, Kent
Subject: grub 'if' expression with 'or' operation
Date: Tue, 21 Aug 2012 08:18:57 -0700

Hello,

I'm trying to write an expression that will be true if either one of two files 
are present. The expression must return true if either ntldr or bootmgr is 
present on the first partition of the first drive. If either one is present I 
want to boot to windows on that partition.

So I tried:

if [ -e (hd0,msdos1)/ntldr -o -e (hd0,msdos1)/bootmgr ] ; then
   #do stuff to boot windows

This works great if ntldr is present. But if ntldr is NOT present, and bootmgr 
is present, then the test fails. So I reversed the order:

if [ -e (hd0,msdos1)/bootmgr -o -e (hd0,msdos1)/ntldr ] ; then
   #do stuff to boot windows
        
Which works if bootmgr is present, but not for ntldr.

In other words, it appears that combining expressions with or operation does 
not work. Only the first operand is used. Is the or operation implemented?

I guess I can change separate the expression into two separate if statements.

Thanks,
Kent Loving



reply via email to

[Prev in Thread] Current Thread [Next in Thread]