Subject: Re: Tab completion in /bin/sh
To: Richard Rauch <rkr@olib.org>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 05/04/2005 00:05:18
On Tue, May 03, 2005 at 05:38:50PM -0500, Richard Rauch wrote:
> Thanks for agreeing with the basic point (if we don't include "PERL",
> we shouldn't include ksh93).
> 
> I never use file-complete.  I find it a ghastly feature, which is why
> I pointed out that it has to be able to be turned off.

I type <tab> in too many command lines, esp. in '[<space><tab>]*' patterns.
Using <tab> for filename completion is a pain, with wildcards and 'cut and
paste' it isn't really necessary.
 
> As for removing /bin/ksh altogether: Well, I've been toying with
> the idea of setting my default shell to /bin/sh...  If you really
> want to be minimalist, we should ditch /bin/csh, since it is no
> longer actually required for anything (it used to be that the
> external "which" command was a csh script, I believe, but someone
> rewrote it; I think that that was the only place csh was required
> in the base system---other than also being a default shell for
> root).

You should use 'type' or 'command -[V|v]' not 'which', the latter is posix.
Both will tell you what the shell will actually do, not what some other
program thinks it might do.

> But, getting back to /bin/ksh: How can you get arbitrary commands
> to run in your prompt in /bin/sh?  E.g., here are two prompts; I'd
> like to know how to do them (using general mechanisms) in /bin/sh:
> 
>      PS1='(`/bin/hostname`) `/bin/date "+%Y%m%d %H%M%S"` : `/bin/pwd`| '
> 
>      PS1='Cap: `/bin/df . | /usr/bin/awk '"'"'/%/{print $5}'"'"'` `pwd`| '
> 
> (Sorry for the ugly quoting in the second one.)
> 
> That's one thing that I know, offhand, that I use in /bin/ksh but which
> doesn't seem to exist in /bin/sh.

There is something in posix to do with dynamic prompts that /bin/sh doesn't
(yet) do.  Maybe one day it will.


	David

-- 
David Laight: david@l8s.co.uk