How to? Avoid expansion and escaping

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
I have a .ini file with a value like this:
this %is% || a `parameter` %+ another %= && another 'abc';

I'm reading the line @iniread. How can I set this verbatim to an environment variable, then echo that environment variable value, then pass it as a parameter to another program? (without ever interpreting the line)
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#2
I have a .ini file with a value like this:
this %is% || a `parameter` %+ another %= && another 'abc';

I'm reading the line @iniread. How can I set this verbatim to an environment variable, then echo that environment variable value, then pass it as a parameter to another program? (without ever interpreting the line)
@INIREAD doesn't care about special characters. But you'll want to turn off nested variable expansion (SETDOS /X-4) so TCC doesn't try to expand the variables in the returned value.

If you want to echo it (why?) you can use ECHOX, which doesn't do any variable expansion, redirection, multiple commands, or compound commands.

If you want to pass it to another program you'll have to use SETDOS /X-35 to turn off variable expansion and multiple commands / conditional commands / piping. (Maybe add 7 to ignore quoting too.)
 
#3
Almost there... How can I pass this strange line in a variable (a) to another command without the %is% expanding?



And yes, the @iniread works fine, was just an example of getting a line with special characters, I'm also using @fileread, @line, and @xmlxpath. The echo is to be able to see the line on the console as part of the script. Attached are the files shown.
 

Attachments