zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: Re: Parameter expansion, etc
  1999-06-14 16:45 PATCH: Re: Parameter expansion, etc Kiddle, Oliver
@ 1999-06-14 16:41 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-06-14 16:41 UTC (permalink / raw)
  To: zsh-workers

"Kiddle, Oliver" wrote:
> 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.

The standard way is [2,-1].

> In what circumstances should --enable-zsh-mem be used? I tried it on AIX and
> I get occaisional errors:
> 
> Catastrophe in realloc: invalid storage ptr

Aix (3, at least) is definitely catastrophic.  I haven't looked into the
details, though that's what I'm using here.  It should work on most
systems.  I don't think anyone has performed reliable comparisons of when
it works better then the system's own version.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] 2+ messages in thread

* PATCH: Re: Parameter expansion, etc
@ 1999-06-14 16:45 Kiddle, Oliver
  1999-06-14 16:41 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Kiddle, Oliver @ 1999-06-14 16:45 UTC (permalink / raw)
  To: 'zsh-workers@sunsite.auc.dk'

Peter Stephenson <pws@ibmth.df.unipi.it> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-06-14 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-14 16:45 PATCH: Re: Parameter expansion, etc Kiddle, Oliver
1999-06-14 16:41 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).