From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26869 invoked from network); 9 Jul 1999 13:54:12 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Jul 1999 13:54:12 -0000 Received: (qmail 28560 invoked by alias); 9 Jul 1999 13:54:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7084 Received: (qmail 28552 invoked from network); 9 Jul 1999 13:53:59 -0000 Message-ID: <3785FED9.C361BFD6@thoth.u-net.com> Date: Fri, 09 Jul 1999 14:53:29 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: zsh-workers@sunsite.auc.dk Subject: Re: PATCH: completions for su and implicit fg/bg References: <9907091234.AA18577@ibmth.df.unipi.it> <3785FAFB.3E9FDD41@thoth.u-net.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Peter Stephenson wrote: > > Yes, of course that's the right place. This patch moves it there. > Also, the obvious way of getting the shell is from $SHELL, so I added that > to _su. You don't want to use $SHELL. The command is run using the default shell of the user which is su'd to. So if I type su fred -c command, then the command will be run using fred's default shell. This is why I used $words[base] to get the username parameter as given to su which it then looks up in /etc/passwd. > > And: nothing against giving _normal (an) optional argument(s) that > > will be put at the front of $words. (_normal is one of the older > > Sounds reasonable, but I haven't looked at this. Seeing as it's possible to stick stuff at the beginning of $words it isn't essential to allow this to be a parameter. I suppose it will be more readable for completions which use it though so is probably worth doing. If you want to include it, the single line: words=( $@ $words[@] ) added to the start of _normal should do the trick. In _su, the for loop is just replaced by _normal $shell Although, you could ditch the shell variable and put the expansion after _normal. I'll send a patch if it makes it easier. Oliver Kiddle P.S. Sorry Peter, you'll get this twice as I accidentally did a Reply instead of Replyall and am now resending.