From: Ben Knoble <ben.knoble@gmail.com>
To: paul@mad-scientist.net
Cc: git@vger.kernel.org
Subject: Re: Solaris sed
Date: Thu, 12 Jun 2025 18:52:12 -0400 [thread overview]
Message-ID: <CAA388EA-9C6A-439F-BF67-ED40DE97F532@gmail.com> (raw)
> Le 12 juin 2025 à 09:42, Paul Smith <paul@mad-scientist.net> a écrit :
>
> On Thu, 2025-06-12 at 01:50 -0400, Eric Sunshine wrote:
>> Had it used the simpler:
>> echo "$foo"
>> this sort of problem (forgetting the "\n") would never have occurred.
>
> Just be aware that echo is not well-standardized: many versions of echo
> accept extra options or treat certain chars specially. So, printf
> (which IS well-standardized) is always safer unless you are 100% sure
> that the text on the echo command line is simple: cannot start with a
> "-", doesn't contain special chars like backslash, etc.
>
> For portability I (personally) always prefer printf unless I know
> exactly what the text contains (like showing a static string).
For exactly this reason, I attempted to write echo(1) to the standards I could find freely available; POSIX mentioned 4, IIRC.
https://github.com/benknoble/echocho
next reply other threads:[~2025-06-12 22:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 22:52 Ben Knoble [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-06-12 3:23 Solaris sed Brad Smith
2025-06-12 3:42 ` Collin Funk
2025-06-12 3:49 ` Brad Smith
2025-06-12 4:16 ` Eli Schwartz
2025-06-12 4:25 ` Collin Funk
2025-06-12 4:26 ` Brad Smith
2025-06-12 4:03 ` Junio C Hamano
2025-06-12 4:13 ` Brad Smith
2025-06-12 4:19 ` Collin Funk
2025-06-13 20:13 ` Jean-Noël AVILA
2025-06-13 20:23 ` Eric Sunshine
2025-06-13 20:30 ` Collin Funk
2025-06-12 5:50 ` Eric Sunshine
2025-06-12 13:35 ` Paul Smith
2025-06-12 16:40 ` Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA388EA-9C6A-439F-BF67-ED40DE97F532@gmail.com \
--to=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=paul@mad-scientist.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox