Hey there my fellow esteemed Monks!

I've been having a long-running problem that I'm finally fed up enough with to ask for help.

In my test suite for berrybrew, I perform a path substitution in a configuration file before the tests load. The specific command which is run out of a batch script looks like this:

call perl -i.bak -ne "s/berrybrew(?!\\+test)/berrybrew\\test/; print" +test/data/config.json

Essentially, that's supposed to change the path C:\berrybrew to C:\berrybrew\test.

On some of my Windows 10 systems, it works just fine, and everything goes on its merry way. On other Win10 systems, the change results in a tab character being inserted, so the path looks like this: C:\berrybrew[TAB]est. If I insert four backslashes in the replacement (ie. berrybrew\\\\test, it works. However, after a git push then a git pull on the other systems that work with just the two backslashes, it breaks.

What can I do to provide myself some consistency across systems? Is there some unicode trick or something I can use? I've tried replacing the forward slashes in the substitution to single-quotes (eg: s///; to s''';) to no avail.

I'd really like to get this resolved so that the substitution works reliably across all systems.

Cheers,

-stevieb


In reply to Windows and backslashes and replacements oh my! by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.