/bin/sh vi-mode command line editing pathname expansion
Jilles Tjoelker
jilles at stack.nl
Sat Apr 3 16:02:05 UTC 2010
On Fri, Apr 02, 2010 at 08:22:56AM -0600, Nathan Weeks wrote:
> The following vi-mode command line editing features seem to be
> missing from FreeBSD 8.0's /bin/sh.
> =
> Display the possible shell word expansions (see wordexp )
> of the bigword at the current command line position...
> \
> Perform pathname expansion (see Pathname Expansion )
> on the current bigword, up to the largest set of characters
> that can be matched uniquely...
> *
> Perform pathname expansion on the current bigword and
> insert all expansions into the command to replace the current
> bigword, with each expansion separated by a single <space>...
> Full descriptions are here:
> http://www.opengroup.org/onlinepubs/9699919799/utilities/sh.html
"bigword" is not good: it disallows file name completion with spaces
(unless we implement ksh-like $'quoting' and put in $'\040' for a
space, which is ugly).
> This would be handy to have out-of-the-box so one doesn't have
> to install bash or ksh to have a POSIX shell that can do this kind
> of pathname expansion in an interactive shell.
NetBSD has file name completion in sh/libedit (optionally with <Tab> as
people expect) but I think it is still a bit too simplistic: it does not
quote spaces and the like. Because not doing this quoting is highly
surprising in a negative way and other shells I've tried (bash, zsh,
ksh93, mksh) do it, I think it is a requirement.
If stefanf@ (de facto libedit maintainer) ports over the NetBSD code and
someone takes care of the quoting issue, I would not be opposed to it.
A more general question is how far we should go with this kind of
features. Our /bin/sh is not bash or zsh and probably should not be.
Unfortunately, this means that people who want a good interactive
Bourne-style shell have to resort to ports/packages and install bash,
zsh, mksh or possibly ksh93. I don't think non-embedded operating
systems based on FreeBSD should default to /bin/sh as a shell for users.
--
Jilles Tjoelker
More information about the freebsd-standards
mailing list