Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Parameter expansion, etc
- X-seq: zsh-workers 6624
- From: "Kiddle, Oliver" <KiddleO@xxxxxxxxxx>
- To: "'zsh-workers@xxxxxxxxxxxxxx'" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: Re: Parameter expansion, etc
- Date: Mon, 14 Jun 1999 17:45:13 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author