Subject: Re: command-line editing and "standard" shells....
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: current-users
Date: 03/19/1999 19:04:45
[ On Friday, March 19, 1999 at 09:38:07 (-0800), [This is my bacque pas, this is my faux pas] wrote: ]
> Subject: Re: command-line editing and "standard" shells....
>
> What's the chances we could officially hack the shell to handle
> - not requiring "fg" before "%job"

I'm not sure this is a good idea -- it kinda violates the command
syntax.

> - handling {} expansion

already done in PD-KSH:

KSH(1)                    User commands                    KSH(1)

   Brace Expansion (alternation)
       Brace expressions, which take the form
              prefix{str1,...,strN}suffix
       are  expanded  to N words, each of which is the concatena-
       tion of prefix, stri and  suffix  (e.g.,  `a{c,b{X,Y},d}e'
       expands to four word: ace, abXe, abYe, and ade).  As noted
       in the example, brace expressions can be  nested  and  the
       resulting  words  are  not sorted.  Brace expressions must
       contain an unquoted  comma  (,)  for  expansion  to  occur
       (i.e., {} and {foo} are not expanded).  Brace expansion is
       carried out after parameter substitution and  before  file
       name generation.

> - allowing shell functions which are not limited to [A-Za-z0-9_-]

Hmmmm????  Like?  Why?

(I think this is relatively difficult to do without going back to a
hand-crafted parser too.  It might break POSIX compatability too.)

> - doing something similar to a .cshrc at time of "su"

It already works!  Just put these in your ~/.profile:

export ENVFILE=~/.kshrc
export ENV='${ENVFILE[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'

and then so long as root's default shell is /bin/ksh everything will
work just as you expect it to (though even if it's not you'll still get
your startup script when you start ksh unless root's startup clobbers
ENV and/or ENVFILE).  Of course you can use 'su -m' to get ksh
regardless of what root's shell is.

(Note that the ENV magic is somewhat similar to what Korn recommened in
the kornshell book, but his example in the book didn't work, and was not
portable to all the versions of ksh that I've ever used.  This
particular bit of magic that I use was gleaned from one of Korn's Usenet
postings many years ago.)

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>