I'm unclear about the rules for double-dollars with bracketed
parameters. From the man page:
==================
Parameter expansion in the + command is different than in
normal commands. If the command is adding to a function,
single letter parameters are expanded normally which is
often not what was intended. To suppress expansion the '$'
has to be doubled. Parameters enclosed in brackets are pro-
tected from parameter expansion in these commands so the '$'
must not be doubled.
==================
Suppose I have:
DestroyMenu MyMenu
AddToMenu MyMenu
+ "My Item" MyFunc $[param1]
...
DestroyFunc MyFunc
AddToFunc MyFunc
+ I Exec exec my_script $0 $[param2] $[param3]
where $[paramN] are being updated elsewhere via SetEnv. Is it safe to
assume that what is true for functions is also true for menus: the
parameter is expanded at runtime, not at read time, so a single dollar
is fine?
If my "+" command has a PipeRead, do the rules change? An earlier
posting stated:
==================
> > > > You can't make calculations in fvwm commands. Use the shell via
> > > > PipeRead instead:
> > > >
> > > > Key Left FSTW SCM PipeRead "echo MoveToPage $[$[page.nx]-1]
$[page.ny]"
>
> Add another '$' here:
>
> Key Left FSTW SCM PipeRead "echo MoveToPage $$[$[page.nx]-1]
$[page.ny]"
> ^^
This would work if the command PipeRead was by itself. But the command
here is Key. If this line is placed in .fvwm2rc it's always equivalent
to:
Key Left FSTW SCM PipeRead "echo MoveToPage $$[0-1] 0"
We should escape all dollars for the Key command. The correct line is:
Key Left FSTW SCM PipeRead "echo MoveToPage $$$$[$$[page.nx]-1]
$$[page.ny]"
==================
When is it correct to double-dollar bracketed parameters? Is the
quad-dollar guidance unique to Key-with-PipeRead?
Gregg Dameron
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Sat Mar 23 2002 - 18:00:06 GMT