Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Actually do test what I claimed to test

On 2015/11/27, at 5:13, Danek Duvall <duvall@xxxxxxxxxxxxxx> wrote:
> Doesn't work on Solaris unless you scrap the space between the "a" and the
> backslash.  Then it seems to do the trick, and with GNU sed, too.

It still fails on Mac OS X and freebsd (maybe also on other BSD's).
sed on these OS's strips the leading white spaces before the 'text'
in the following command:


On the zsh command line, I can use (both on Linux and OS X)

% sed '/pat/a\
\  text' < in > out

but if I modify V10private.ztst as

 sed '/^%prep/a\
\ zmodload zsh/param/private' < ... > ...

the I get

(eval):3: unmatched '

Is there any way to properly quote the \ (at the beginning of line) in ztst
file? If not, using awk may be a possible alternative.

diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index bb456f2..5efc453 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -8,8 +8,8 @@
  # Do not use .tmp here, ztst.zsh will remove it too soon (see %cleanup)
  mkdir private.TMP
- sed '/^%prep/a\
-  zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
+ awk '1; /%prep/ {print " zmodload zsh/param/private"}' \
+   $ZTST_srcdir/B02typeset.ztst > private.TMP/B02

Messages sorted by: Reverse Date, Date, Thread, Author