coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] doc: printf: make "java" encoding example more standard


From: Pádraig Brady
Subject: Re: [PATCH] doc: printf: make "java" encoding example more standard
Date: Fri, 28 Oct 2022 16:43:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Thunderbird/98.0

On 28/10/2022 15:50, Kaz Kylheku wrote:
On 2022-10-28 06:54, Pádraig Brady wrote:
Note using iconv(1) rather than recode(1) is not appropriate
for this example, as the required functionality is only
available on libiconv's iconv implementation, which is
not installed on most systems.

Note that there is an iconv in POSIX; recode is nonstandard.

Right, which is why I thought the note was needed
to say why we weren't using the more standard iconv in the example.


* doc/coreutils.texi (printf invocation): Use env rather than
/usr/local/bin for the printf command.  Escape '%' so more robust.
Also use a locale that exists on modern systems.

Why would you need env in a shell script, except in the
hash bang line? The command interpreter is already searching PATH
for commands. The other features of env like setting up environment
variables is done in shell syntax, which the example is doing:

   LC_CTYPE=zh_TW.big5 env printf ...
   ^^^^^^^^^^^^^^^^^^^

Moreover, here, PATH search takes place to find env. If PATH
resolution weren't working (so that we had to use env), we would
have to call it as /usr/bin/env.

The env is to avoid the builtin printf in some shells.

thanks,
Pádraig




reply via email to

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