On Wed, May 15, 2024 at 08:27:37PM -0400, Jeffrey Walton wrote:
> On Wed, May 15, 2024 at 6:20 PM Greg Wooledge <greg@wooledge.org> wrote:
>
> > On Wed, May 15, 2024 at 06:01:04PM -0400, Jeffrey Walton wrote:
> > > On Wed, May 15, 2024 at 3:48 PM Peng Yu <pengyu.ut@gmail.com> wrote:
> > >
> > > > No. I need to just read one character.
> > > >
> > >
> > > `tail -c +1` will read just one character.
> >
> > I think you have the wrong command. Perhaps you meant "head -c 1"?
> >
>
> No. head does not have a -c option, see <
>https://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html>.
Then it's a GNUism. "tail -c +1" does not do what you wanted, and
"head -c 1" is non-portable. That leaves dd, if portability is needed.