The question is: Is it necessary? If you’re already evaluating the
commands at the shell level, calling another subshell to evaluate more
code is probably superfluous.
Think about it. The PipeRead command in “MyGotoDesk” is superfluous in this context. The
evaluation it performs is nothing – the $[desk.n] variable is still
interpolated without it, hence you can just do:
+ I Next (State $[desk.n]) Focus
… of course, if that “MyGotoDesk” function is only ever called from the
‘FlipDesk’ function then you can just change the FlipDesk function:
No, it’s not necessary. I just wanted to know if it was possible.
For some reason I was under the impression that command expansion didn’t work inside the parenthesis of a conditional command and so I was relying on the PipeRead to do the substitution for me. Thanks for showing me that wasn’t necessary.
I make use of $0 in the test and in the else. What the function does is sends you to the target desktop if you’re not already there. If you are already at the target desktop, it sends you to the previous desktop. There’s probably a better way of doing it, but this is what I tried first.
No, but you did show me that my solution could be greatly improved in ways that wouldn’t require nested PipeReads. Thanks for setting me straight on the command expansion within conditionals bit, that was my primary use for PipeReads (and made for an ugly config file).