[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ed -p '' errors, but shouldn't
From: |
Andrew L. Moore |
Subject: |
Re: ed -p '' errors, but shouldn't |
Date: |
Fri, 5 Jul 2024 05:03:24 -0400 |
User-agent: |
Mozilla Thunderbird |
I'll weigh in:
ed -p '' should provide an empty prompt (no error).
ed -p'' should produce an error.
Contrary to Antonio's assertion as I understand it, empty arguments are
very common and useful as place-holders. For instance in the context of
a script:
ed -p "$an_unset_variable" file
should never be the equivalent of
ed -p file
Moreover, POSIX tends to lean towards permissiveness (e.g., using 0 as
an address), so if where there's ambiguity, don't generate an error if
there's a reasonable alternative.
I appreciate that there are option parsers which require an argument to
follow directly after a short option - e.g.,
cmd -oarg
works but
cmd -o arg
does not. That's a bug in the option parser and a separate issue.
-AM
- Re: ed -p '' errors, but shouldn't,
Andrew L. Moore <=