zsh-workers
 help / color / mirror / code / Atom feed
From: "Kiddle, Oliver" <KiddleO@logica.com>
To: "'zsh-workers@sunsite.auc.dk'" <zsh-workers@sunsite.auc.dk>
Subject: PATCH: Re: Parameter expansion, etc
Date: Mon, 14 Jun 1999 17:45:13 +0100	[thread overview]
Message-ID: <4FBF540FF16FD1119D9600A0C94B2B51F29E85@napier.logica.co.uk> (raw)

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


             reply	other threads:[~1999-06-14 16:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-14 16:45 Kiddle, Oliver [this message]
1999-06-14 16:41 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FBF540FF16FD1119D9600A0C94B2B51F29E85@napier.logica.co.uk \
    --to=kiddleo@logica.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).