In a typical unix shell, you can type a multiline command using \, that is:
shell>some -really -long -command 'string\
more string stuff'
I'm trying to build a test using
Test::Expect, but I'm finding it hard to duplicate the above.
I tried a few variations and
expect_send(qq{some -command 'string stuff\\ \cM more on next line'},
+"Testing...");
seems to send the right stuff, escaping and sending a '\', then a newline. But I think Expect.pm is getting confused because it seems to treat the second part of the command as the expected output.
Is there a standard way to do this? Who's getting confused,
Test::Expect,
Expect::Simple, or
Expect.pm?
Update:One other question: even if I get this working, will this test only work in some shells? That is, if I wanted it to be multi-platform, would I need multiple versions of the test?
Update:Modified example to show that the newline is inside a quoted string.
Thanks for any suggestions.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.