Subject: FVWM: echo complicated environment variables

From: Victor Eijkhout <[email-masked]>
Date: Tue, 22 Oct 2002 14:14:08 -0400

2.4.11

Echo $[pict-0-$[page.nx]-$[page.ny]]

gives

[FVWM][Echo]:  $[pict-0-$[page.nx]-0]

which I don't understand at all.
-- 
Victor Eijkhout <[email-masked]>
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 22 Oct 2002 20:07:10 +0000

> which I don't understand at all.

This is the current feature, nested $[] are not allowed, so effectivelly
the first variable inside $[] is not expanded, but all others are ok.
This is because $[pict-0-$[page.nx] is considered as one $[] variable.

Generally, the rule is: only valid and currently defined $[var.name] are
expanded by fvwm, all other $[] strings are left as is.

Anyway, if you add additional dollar at the beginning:

  Echo $$[pict-0-$[page.nx]-$[page.ny]]

it will be expanded as you want (I hope so, because you didn't say what
you want to get):

  [FVWM][Echo]:  $[pict-0-2-3]

Regards,
Mikhael.

---

From: Victor Eijkhout <[email-masked]>
Date: Tue, 22 Oct 2002 16:24:02 -0400

>   [FVWM][Echo]:  $[pict-0-2-3]

Actually, then I want *that* to be expanded. I guess I can do that 
with a two-step process.

What I want is first to

SetEnv pict-$$d-$[page.nx]-$[page.ny] 1

(that works, I tried)
and then be able to test it in

Exec if [ $[pict-$$d-$[page.nx]-$[page.ny]] -ne 1 ] ; then 
xvirtualroot -f <picture for this desk and page>

Ultimate goal: integrate FvwmBacker & xvirtualroot to get background 
picture per desktop & maybe per page. Something like

*FvwmBacker: Command (Desk *,Page * *) Function ChangeDesk
DestroyFunc ChangeDesk
AddToFunc ChangeDesk
+ I Exec if [ $[pict-$$d-$[page.nx]-$[page.ny]] -ne 1 ] ;
              then xvirtualroot -f   $[HOME]/.fvwm/$$d.xpm
                              -xrm "*Desk: $$d $[page.nx] $[page.ny]" ; fi
+ I SetEnv pict-$$d-$[page.nx]-$[page.ny] 1

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 22 Oct 2002 22:12:33 +0000

> + I SetEnv pict-$$d-$[page.nx]-$[page.ny] 1

Ok, I see now what you want. There are 2 problems with the above.

A shell variable can't have a dash in their name, so replace it with
underscore: pict_$$d_$[page.nx]_$[page.ny]

Now, leave some work to a shell, if you already do Exec. Like:

  Exec if [ "$$pict_$$d_$[page.nx]_$[page.ny]" -ne 1 ]; then bla-bla; fi

The shell then receives this:

  if [ "$pict_1_2_3" -ne 1 ]; then bla-bla; fi

Regards,
Mikhael.