Export to GitHub

grub4dos-chenall - issue #118

Enhancement: multiple commands on one line (non-conditional)


Posted on Feb 21, 2013 by Happy Kangaroo

What steps will reproduce the problem?

Example only (uses uuid as an example only).

uuid (hd2,1) && set UUID=%?%

does not work correctly. Firstly UUID is only set if hd2,1 exists (second command is not executed so UUID still set to previous value). Secondly, UUID is not set if hd2,1 is valid, because environment is not changed when 2nd command executed.

(call set UUID=%^?% must be used)

  1. suggest a NEW command - unconditional ++

e.g.

uuid (bd) ++ set UUID=%?%

is equivalent to

uuid (bd) set UUID=%?%

This could be implemented by the menu.lst pre-parser inserting \n if <white space>++<white space> is seen so that commands are executed in correct environment?

Others suggestions are:

<white space>;<white space> <white space>&&&<white space> <white space>&<white space> <white space>[&]<white space> <white space>(&)<white space>

2. 3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Comment #1

Posted on Mar 2, 2013 by Happy Hippo

I have an idea: use "!" like windows command-line. For example uuid (hd0, 0) && set uuid =!?!

Comment #2

Posted on Mar 2, 2013 by Happy Kangaroo

I really wanted an equivalent to & in Windows, so two command could be run on the same line. The UUID was just an example. UUID is not the problem, the problem is puting two commands on the same line. && and || are conditional, I want an UNconditional notation that will work as if there were multiple command lines. e.g. combine two or more commands on one line - the following should work (if we use ++ as new notation) set a=1 ++ echo %a% should echo 1 set b=1 ++ set c=%b% & set should set c to 1

Comment #3

Posted on Mar 3, 2013 by Happy Hippo

understand, I will try.

Comment #4

Posted on Mar 3, 2013 by Happy Hippo

Comment deleted

Comment #5

Posted on Mar 17, 2013 by Happy Kangaroo

This would be most useful in

iftitle [do something ++ do something else ++ test result] ddddddddd

Comment #6

Posted on Mar 19, 2013 by Happy Hippo

Try this.. use";;" command1 ;; command2 ;; command3 ;; commandn

Attachments

Comment #7

Posted on Mar 19, 2013 by Happy Kangaroo

Comment deleted

Comment #8

Posted on Mar 19, 2013 by Happy Kangaroo

iftitle [uuid (hd0,0) ;; set UUID=%?_UUID% ;; if "%UUID%"=="028B-3924"] test me UUID reboot

works ! brilliant! thank you!

Comment #9

Posted on Mar 19, 2013 by Happy Kangaroo

P.S. it seems syntax is

;;

as single space or single TAB is required.

Comment #10

Posted on Mar 19, 2013 by Happy Hippo

Yes! just like "&&" "||" the space is required.

Comment #11

Posted on Mar 19, 2013 by Happy Kangaroo

set H=0 ;; hiddenflag (hd0,0) && set H=1 ;; echo HIDDEN=%h%

Note that the above line is equivalent to set H=0 hiddenflag (hd0,0) && set H=1 echo HIDDEN=%h%

and so always returns HIDDEN=0 or 1

This is correct and as expected - Good!

Comment #12

Posted on Mar 19, 2013 by Happy Kangaroo

This will test for the ;; support

set g4new=1 ;; set g4new=2 && call if not "%^g4new%"=="2" echo ERROR: This old grub4dos version does not support the ;; operator! && pause

Comment #13

Posted on Mar 19, 2013 by Happy Hippo

set g4new=1 ;; set g4new=2 && call if not "%^g4new%"=="2" echo ERROR: This old grub4dos version does not support the ;; operator! && pause if the same as set g4new=1 set g4new=2 && call if not "%^g4new%"=="2" echo ERROR: This old grub4dos version does not support the operator! && pause

So.it's wrong. try set g4new=1 ;; echo supported! && if not "%g4new%"=="1" echo Error: this grub4dos version does not support the ";;" operation!

Comment #14

Posted on Mar 19, 2013 by Happy Kangaroo

my code works too - i tested it on both versions???

yours is better though! ;-)

Comment #15

Posted on Mar 19, 2013 by Happy Kangaroo

or set g4new=1 ;; echo -e \;\; is supported! && if not "%g4new%"=="1" echo Error: this grub4dos version does not support the ";;" operation!

Comment #16

Posted on Mar 20, 2013 by Happy Hippo

14

because debug off. if debug on.with new version you may get a message "Warning! No such command: operator!"

Status: Done

Labels:
Type-Defect Priority-Medium