Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Apr 2010 18:02:04 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Nathan Weeks <weeks@iastate.edu>
Cc:        freebsd-standards@freebsd.org
Subject:   Re: /bin/sh vi-mode command line editing pathname expansion
Message-ID:  <20100403160203.GA19283@stack.nl>
In-Reply-To: <q2x8f47e3001004020722k91dc69cw5157fb0438e5244c@mail.gmail.com>
References:  <q2x8f47e3001004020722k91dc69cw5157fb0438e5244c@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100403160203.GA19283>