Loading ...
Sorry, an error occurred while loading the content.

Re: sed bug causing build failure?

Expand Messages
  • Bram Moolenaar
    ... If you use backticks like that, the shell will remove the (trailing) newline for you. Most commands add line breaks, thus the shell removes them. Try this
    Message 1 of 4 , Dec 27, 2003
    • 0 Attachment
      Johnston D Johnston wrote:

      > On Wed, 24 Dec 2003 15:00:03 +0100,
      > Bram Moolenaar <Bram@...> wrote:
      > > Mark Waggoner wrote:
      > [...]
      > > > I needed to modify this to be:
      > > >
      > > > perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
      > > > -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'`
      > >
      > > Why doesn't Perl add a newline after the text it writes to stdout?
      > > Anyway, that's how it is.
      >
      > It's a *good* thing that Perl doesn't add a newline. The output of the
      > subs ccflags(), perl_inc(), ldopts(), &c. was designed to be "glued"
      > into a cc command line, such as:
      >
      > cc -o prog prog.c `perl -MExtUtils::Embed -e ccflags -e ldopts`
      >
      > Naturally, you wouldn't want newlines in the middle of your cc command.

      If you use backticks like that, the shell will remove the (trailing)
      newline for you. Most commands add line breaks, thus the shell removes
      them.

      Try this with a short "file" that contains line breaks:

      echo `cat file`

      It will display a single line.

      Thus Perl should add a newline in that output.

      --
      From "know your smileys":
      *<|:-) Santa Claus (Ho Ho Ho)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.