Ticket #333 (Invalid)Thu Jan 17 21:09:11 UTC 2013
Redirection with curly brackets over-riding If Then
Reported by: | Ronald May (387) | Severity: | Normal |
Part: | RISC OS: General | Release: | |
Milestone: | Status | Invalid |
Details by Ronald May (387):
When using { > file } from the CLI, in an Obey file or Alias, file is /always/ opened.
*Set var yes
*If “<var>” = “no” Then Echo no { > decision }
The only way to do this is to use Spool, but on my Iyonix 5.18 Spool outputs to the
vdu as well as to spool file. I haven’t found the *FX3 options yet, could relevant
ones be included with *help spool ?
Changelog:
Modified by Ronald May (387) Thu, January 17 2013 - 21:26:48 GMT
- Part changed from Unspecified to RISC OS: General
Modified by Sprow (202) Thu, January 17 2013 - 21:42:08 GMT
- Status changed from Open to Invalid
This is an operator precedence question. The answer is in the section on redirection in PRM 1-959.
“The redirection specifier can appear anywhere in a line. Note that there must be exactly
one space between each element, or it will not be recognised as one. After being
decoded. The redirection specifier is stripped before the rest of the command is
interpreted.”
So, the first step looks at the *IF line and finds redirection is requested and creates the output. Then it removes the {} bit and passes the remainder to the *IF evaluator.
The cunning people in the forums can probably come up with a solution, probably involving the *DO command.