From: Michael J Gruber <git@grubix.eu>
To: David Bremner <david@tethera.net>,
Tomi Ollila <tomi.ollila@iki.fi>,
notmuch@notmuchmail.org
Subject: Re: [PATCH 2/4] test: due not pass T380.1 for the wrong reasons
Date: Sun, 20 Feb 2022 11:58:22 +0100 [thread overview]
Message-ID: <164535470209.4544.9894205177904049274.git@grubix.eu> (raw)
In-Reply-To: <877d9qqx2n.fsf@tethera.net>
David Bremner venit, vidit, dixit 2022-02-20 00:02:40:
> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
> >
> > Wat? afaik echo is builtin in every modern bourne shell derivative...
> >
> > (I tested:
> > $ bash -c 'builtin echo foo'
> > foo
> > $ bash -c 'export PATH=/tmp; echo foo; ls'
> > foo
> > bash: ls: command not found
> > )
>
> Oops. That's what I get for believing "which". Which is another tale of
> woe, of course. Builtin in zsh, and not in bash. Not that it matters
> here, but probably why it doesn't know about bash builtins.
echo is both a builtin (for bash etc) and a command:
$ type echo
echo is a shell builtin
$ which echo
/usr/bin/echo
The latter is part of GNU coreutils (sh-utils) and often used when one
wants to avoid shell pecularities.
printf is a builtin
Due to the way the builtins were specified (or underspecified in the
case of echo) in POSIX, the printf builtin is more portable than the
echo builtin.
As a rule of thumb, the echo builtin is OK if you don't need options
(nor special control sequences) but want a newline at the end of the
output anyways; use printf if you need options or format strings.
Alternatively, require GNU coreutils and use /usr/bin/echo.
Cheers
Michael
P.S.: I haven't forgotten about the series but it needs quite a bit of
rework as we found out.
next prev parent reply other threads:[~2022-02-20 10:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 11:52 [PATCH 0/4] test: T380 rework Michael J Gruber
2022-02-09 11:52 ` [PATCH 1/4] test: correct comparison order in T380 Michael J Gruber
2022-02-09 20:47 ` Tomi Ollila
2022-02-10 10:05 ` Michael J Gruber
2022-02-09 11:52 ` [PATCH 2/4] test: due not pass T380.1 for the wrong reasons Michael J Gruber
2022-02-09 20:49 ` Tomi Ollila
2022-02-10 10:08 ` Michael J Gruber
2022-02-09 22:12 ` David Bremner
2022-02-10 10:56 ` Michael J Gruber
2022-02-12 20:42 ` David Bremner
2022-02-19 21:50 ` Tomi Ollila
2022-02-19 23:02 ` David Bremner
2022-02-20 10:58 ` Michael J Gruber [this message]
2022-02-20 12:58 ` David Bremner
2022-02-09 11:52 ` [PATCH 3/4] test: reword T380.2 to be clearer Michael J Gruber
2022-02-09 20:49 ` Tomi Ollila
2022-02-09 11:52 ` [PATCH 4/4] test: set up the outcount file for T380.1 Michael J Gruber
2022-02-09 20:50 ` Tomi Ollila
2022-02-10 10:13 ` Michael J Gruber
2022-02-10 17:29 ` Tomi Ollila
2023-11-24 17:05 ` [PATCH 0/4] test: T380 rework Michael J Gruber
2023-11-24 22:20 ` Tomi Ollila
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=164535470209.4544.9894205177904049274.git@grubix.eu \
--to=git@grubix.eu \
--cc=david@tethera.net \
--cc=notmuch@notmuchmail.org \
--cc=tomi.ollila@iki.fi \
/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.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).