[darcs-devel] darcs patch: work around backslash problem in test scripts for bett...

Tommy Pettersson ptp at lysator.liu.se
Thu Apr 28 01:32:15 PDT 2005


On Thu, Apr 28, 2005 at 02:03:23AM +0100, Ian Lynagh wrote:
> On Wed, Apr 27, 2005 at 05:28:20PM +0200, ptp at lysator.liu.se wrote:
> > 
> > hunk ./tests/directory_confusion.sh 24
> >  echo altered_text > d/e/afile.txt
> >  $DARCS record --author me --all --no-test --patch-name confusion
> >  test ! -f _darcs/current/afile.txt
> > -echo -e "y\nd\ny" | $DARCS unrecord
> > +echo "y#d#y" | tr '#' '\n' | $DARCS unrecord
> 
> Does
> 
>     printf "foo\nbar\n"
> 
> not work for anyone? I think that would be cleaner.

My problem was that the built in echo in dash echoed the -e
option verbatim.

So I checked on echo in the autobook section about portable
Bourne shell scripting, and it said backslashes should be
avoided...

But now I checked again, and I stopped reading too early
the first time.  Sorry about that.  It says: "try to avoid
backslashes in echo arguments unless they are expanded by
the shell".  The problem is only how to get _unexpanded_
backslashes in echo arguments.

So the right fix seems to be just omitting the -e option.

Since echo has worked so far I think it's safer to keep it
than to change to printf.


-- 
Tommy Pettersson <ptp at lysator.liu.se>




More information about the darcs-devel mailing list