Article View: alt.folklore.computers
Article #930Re: Portability of 'echo -n'
From: Waldek Hebisch
Date: Sat, 07 Nov 2026 21:24
Date: Sat, 07 Nov 2026 21:24
30 lines
2687 bytes
2687 bytes
Nuno Silva <nunojsilva@invalid.invalid> wrote:
> On 2026-11-07, Lawrence D’Oliveiro wrote:
>
>> On Fri, 6 Nov 2026 21:52:32 -0000 (UTC), Waldek Hebisch wrote:
>>
>>> Supressing newline in echo is used by quite a lot of shell scripts
>>> and the '-n' option is normal way to do this on Linux.
>>
>> As on every other *nix that uses the GNU userland utilities.
>>
>> I really cannot imagine anybody wanting a command environment that did
>> not interpret “-n” in this way ...
>
> It is non-standard, and that has implications for portability. However
> convenient that "-n" option may be where present, is there really a
> reason not to use something more portable and conformant? IEEE
> 1003.1-2008 suggests printf (84381–84383).
Recently I had displeasure to use 'printf' in a Makefile, in my
setup that lead to orgy of quoting. Comparing, cases when
'echo -n' were enough were much simpler.
'echo -n' is standard, AFAIK it is GNU standard and compatible
with Posix. It seems that only Unix compliance disallows it.
Given long history, widespread use and utility there should be
very strong reason to disallow it. I am not aware of such a
reason.
--
Waldek Hebisch
Technical Details
Message-ID:
<11co4v2$37o9q$2@paganini.bofh.team>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!newsfeed.bofh.team!paganini.bofh.team!not-for-mailReferences:
<11bujmd$31udl$1@dont-email.me> <qg3prm-ql7.ln1@ID-313840.user.individual.net> <11cdgp6$46jl$5@dont-email.me> <fcqrrm-5o6.ln1@ID-313840.user.individual.net> <11cg8q2$12d33$1@dont-email.me> <eceurm-lq4.ln1@ID-313840.user.individual.net> <11cijp9$1sunb$1@dont-email.me> <n231sm-d23.ln1@ID-313840.user.individual.net> <11ckp2g$2jqjg$2@dont-email.me> <11cl5im$2nftp$3@dont-email.me> <11cli6u$2u21d$1@paganini.bofh.team> <11clrnu$3188f$1@dont-email.me> <11cmsv6$3a9pr$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: alt.folklore.computers
Subject: Re: Portability of 'echo -n'
Date: Sat, 7 Nov 2026 21:24:52 -0000 (UTC)
Organization: bofh.team Usenet service
Message-ID: <11co4v2$37o9q$2@paganini.bofh.team>
References: <11bujmd$31udl$1@dont-email.me> <qg3prm-ql7.ln1@ID-313840.user.individual.net> <11cdgp6$46jl$5@dont-email.me> <fcqrrm-5o6.ln1@ID-313840.user.individual.net> <11cg8q2$12d33$1@dont-email.me> <eceurm-lq4.ln1@ID-313840.user.individual.net> <11cijp9$1sunb$1@dont-email.me> <n231sm-d23.ln1@ID-313840.user.individual.net> <11ckp2g$2jqjg$2@dont-email.me> <11cl5im$2nftp$3@dont-email.me> <11cli6u$2u21d$1@paganini.bofh.team> <11clrnu$3188f$1@dont-email.me> <11cmsv6$3a9pr$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 7 Nov 2026 21:24:52 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3399994"; mail-complaints-to="usenet@bofh.team"; posting-host="d028f9ad2fa2c51f22dbfed0d81d7daf"; posting-account="69e66f1681224ab92235b464ce7a90b6"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Postfilter: Postfilter-NG 2026.10.2