kxylxp / grub4dos-chenall

Automatically exported from code.google.com/p/grub4dos-chenall
0 stars 0 forks source link

set command syntax too loose #184

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

I am trying to define a variable with a leading space - e.g. " 123"
These all fail and set S as "123"

set S= 123
set S      123
set S====   123

according to 'help set', the syntax is [VARIABLE=[STRING]]

but it seems all leading = and spaces are ignored!

How can I set a leading space in a variable? e.g. " 123"
How can I set a leading = in a variable? e.g. "=123"

Original issue reported on code.google.com by Steve6375 on 25 Jun 2014 at 1:15

GoogleCodeExporter commented 8 years ago
I found one workaround

using a UTF-8 file, I wrote

set S= 123

where the character in front of the "123" string is ASCII 0ffh character (made 
by typing on Number Pad of keyboard   ALT+255)

Original comment by Steve6375 on 25 Jun 2014 at 2:54

GoogleCodeExporter commented 8 years ago
may be we can add new option "/s" to ignore spaces.

e.g

set /s a= abcd --> a=abcd
set a=  abcd   --> a=  abcd

Original comment by chenall.cn on 3 Jul 2014 at 2:20

GoogleCodeExporter commented 8 years ago
Will this work too?

set /s s==123 ;; echo *%s%* --> *=123*

also

set /s s= 123 && xyz ;; ddd    
echo *s*
* 123 && xyz ;; ddd *

i.e. treat whole line after set /s s= (or set /s s ) as literal string.

or maybe use double-quote "xxxx" syntax

set /q s=" =ddd && fff ;; echo 1" ;; echo *%s%* --> * =ddd && fff ;; echo 1*

Original comment by Steve6375 on 3 Jul 2014 at 5:18

GoogleCodeExporter commented 8 years ago
Use double quotes syntax would be better

set "s= asdafd && asdf ;; echo aasdf ;; echo asdfe"

Original comment by chenall.cn on 11 Jul 2014 at 12:05

GoogleCodeExporter commented 8 years ago

https://github.com/chenall/grub4dos/commit/58ee19fa468c130b20eac5af2115bfaf854e9
84c

Original comment by chenall.cn on 4 Aug 2014 at 10:32