bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestions for po.m4


From: Bruno Haible
Subject: Re: Suggestions for po.m4
Date: Tue, 22 Feb 2005 17:43:51 +0100
User-agent: KMail/1.5

Stepan Kasal wrote:
>   in po.m4 distributed with GNU gettext 0.14.1, I see the following:
>
>     cat "$ac_given_srcdir/$ac_dir/POTFILES.in" |
>       sed -e "/^#/d" -e "/^[   ]*\$/d" -e "s,.*,      $top_srcdir/& \\\\," |
>       sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
>
> I'd say that the command could be cleaned up this way:
>
>    sed <"$ac_given_srcdir/$ac_dir/POTFILES.in" \
>       -e '/^#/d' -e '/^[   ]*$/d' -e "s,^,    $top_srcdir/," |
>       sed -e '$!s/$/ \\/' >"$ac_dir/POTFILES"

"cleaned up" is a pejorative term. There's nothing wrong with the commands
as distributed in po.m4.

Your way to write these commands are equivalent. Except that I don't really
trust portability of the sed function '!', given that POSIX talks about
portability problems with it:
  "It is unspecified whether <blank>s can follow a '!' character"
and
  "Historically, the sed ! and } editing commands did not permit multiple
   commands on a single line using a semicolon as a command delimiter.
   Implementations are permitted, but not required, to support this extension."

I do agree that the use of '$!' increases the readability of the sed
expression, though.

If there's nothing wrong with the horse, why replace it with a different
horse?

As a matter of taste, I also dislike a redirection being followed by options.
(For ease of debugging, it's useful to be able to copy & paste a command
without its redirections.)

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]