zsh-workers
 help / color / mirror / code / Atom feed
* Parameter exansion, correction and small patch
@ 1999-06-14 12:52 Kiddle, Oliver
  1999-06-14 14:46 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Kiddle, Oliver @ 1999-06-14 12:52 UTC (permalink / raw)
  To: 'zsh-workers@sunsite.auc.dk'

Two questions:

First, how do I take the output of a command in $(...) and use the parameter
expansion flags to split the output into an array for each line. I'm sure
I've done this before but can't get it to work anymore. I've tried most
things I can think of without success. For example:
  echo ${${(f)$(ps)}% *}
I would expect this to apply the '% *' substitution for each line of the
output of ps but it does it for all the lines combined.

Second, correction seems to be applied when I declare a function which can
be annoying. e.g.
zsh -f
setopt correct
les() {
zsh: correct 'les' to 'els' [nyae]? n
function>

You might consider this to be a bug but if not, is there any way of
preventing it?

Finally, disown has been left out from the new style completions for
builtins. The patch follows (although you can probably do the edit quicker
than you can apply the patch).

Thanks

Oliver Kiddle

*** Completion/Builtins/_jobs.old	Mon Jun 14 13:42:15 1999
--- Completion/Builtins/_jobs	Mon Jun 14 13:42:25 1999
***************
*** 1,3 ****
! #compdef fg jobs
  
  compgen -j -P '%'
--- 1,3 ----
! #compdef disown fg jobs
  
  compgen -j -P '%'


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

* Re: Parameter exansion, correction and small patch
  1999-06-14 12:52 Parameter exansion, correction and small patch Kiddle, Oliver
@ 1999-06-14 14:46 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-06-14 14:46 UTC (permalink / raw)
  To: zsh-workers

"Kiddle, Oliver" wrote:
> Two questions:
> 
> First, how do I take the output of a command in $(...) and use the parameter
> expansion flags to split the output into an array for each line. I'm sure
> I've done this before but can't get it to work anymore. I've tried most
> things I can think of without success. For example:
>   echo ${${(f)$(ps)}% *}
> I would expect this to apply the '% *' substitution for each line of the
> output of ps but it does it for all the lines combined.

The key problem is with quoting.  We just introduced a tweak so that you
can now do
  echo ${${(f)"$(ps)"}% *}
since an unquoted $(ps) does word-splitting on all spaces.  The traditional
way of doing this was
  echo "${(@)${(@f)$(ps)}% *}"
but that's more cumbersome.

> Second, correction seems to be applied when I declare a function which can
> be annoying. e.g.
> zsh -f
> setopt correct
> les() {
> zsh: correct 'les' to 'els' [nyae]? n
> function>
> 
> You might consider this to be a bug but if not, is there any way of
> preventing it?

`correct' isn't all that flexible at the moment.  There ought to be a way
of fixing it internally.

-- 
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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-14 12:52 Parameter exansion, correction and small patch Kiddle, Oliver
1999-06-14 14:46 ` 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).