From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5005 invoked from network); 14 Jun 1999 16:45:27 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Jun 1999 16:45:27 -0000 Received: (qmail 3746 invoked by alias); 14 Jun 1999 16:45:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6624 Received: (qmail 3731 invoked from network); 14 Jun 1999 16:45:16 -0000 Message-ID: <4FBF540FF16FD1119D9600A0C94B2B51F29E85@napier.logica.co.uk> From: "Kiddle, Oliver" To: "'zsh-workers@sunsite.auc.dk'" Subject: PATCH: Re: Parameter expansion, etc Date: Mon, 14 Jun 1999 17:45:13 +0100 X-Mailer: Internet Mail Service (5.5.2448.0) Peter Stephenson wrote: > The key problem is with quoting. We just introduced a tweak so that you > can now do > echo ${${(f)"$(ps)"}% *} Thanks. I didn't quite understand that tweak at the time. The reason I was trying to do this was because the new style completions for wait and kill don't work with IRIX or AIX. I assume this is because of the differences between BSD and SYSV ps. I was only getting the first 4 digits of the PID. The easy fix for this would be to have used cut -c1-6 or awk '{ print $1 }' instead of cut -c1-5 but I was trying to find a way which prevents processes such as tail being included in the process list. Anyway the patch follows. I warn you though that the method I've used may not be the best and I haven't tested it on Linux or anything with a BSD ps. As an aside, is [2,$] the correct way to specify all elements in an array from 2 to the end. It certainly works but isn't documented (atleast not in my ancient print-out). I guessed it and it worked. Thanks Oliver Kiddle *** Completion/Builtins/_kill.old Mon Jun 14 17:15:21 1999 --- Completion/Builtins/_kill Mon Jun 14 17:15:16 1999 *************** *** 9,15 **** compgen -P '%' -j && ret=0 list=("$(ps 2>/dev/null)") ! compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' && ret=0 return ret fi --- 9,15 ---- compgen -P '%' -j && ret=0 list=("$(ps 2>/dev/null)") ! compgen -y '$list' -s '${${${(f)"$(ps)"}[2,$]## #}%% *}' && ret=0 return ret fi *** Completion/Builtins/_wait.old Mon Jun 14 17:19:13 1999 --- Completion/Builtins/_wait Mon Jun 14 17:20:04 1999 *************** *** 4,9 **** compgen -P '%' -j && ret=0 list=("$(ps 2>/dev/null)") ! compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' && ret=0 return ret --- 4,9 ---- compgen -P '%' -j && ret=0 list=("$(ps 2>/dev/null)") ! compgen -y '$list' -s '${${${(f)"$(ps)"}[2,$]## #}%% *}' && ret=0 return ret