put shell() and escaping quotes, how to do this?

Bernard Devlin bdrunrev at gmail.com
Thu Dec 31 03:04:43 EST 2009


Peter,

put "echo -e [[tHex]] > usb/dev/lp0" into tCmd
put quote & "\x1C" & quote into tHex
put shell( merge ( tCmd ) )

It might look a little cumbersome, but hopefully less so than Mark's
suggestion.  The vernacular used above might also bear dividends when
the shell commands get more complex than the example you give.  Much
as I love regex, I find that using merge() makes things much clearer
to me than any other form of textual substitution.  I find myself
missing the simplicity and power of merge() in other languages.

Hope that helps,

Bernard

On Wed, Dec 30, 2009 at 8:25 PM, Peter Alcibiades
<palcibiades-first at yahoo.co.uk> wrote:
>
> David, problem is, it will not let you use double quotes.  So for instance
>
>          put shell("echo -e "\x1C" > usb/dev/lp0")
>
> will not compile, because of the double quotes.  Then if you replace the
> innermost double quotes with single quotes, it compiles fine, and it works
> fine from the shell, but when done from the message box, it prints the \x1C
> instead of escaping the x and treating it as a signal to the shell that we
> are in the land of hex.
>
> Mark thanks.  I'll have a go with it.  Mind boggling, that!  Its like
> regular expressions, there always comes some point at which some simple
> thing makes the head hurt.
>
> Peter



More information about the Use-livecode mailing list