* ${...%%=*} problem
@ 2001-06-07 6:42 Andrej Borsenkow
2001-06-07 7:02 ` Sven Wischnowsky
0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2001-06-07 6:42 UTC (permalink / raw)
To: ZSH Workers Mailing List
bor@itsrm2% print ${foo%%=*}
zsh: * not found
Why?
-andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ${...%%=*} problem
2001-06-07 6:42 ${...%%=*} problem Andrej Borsenkow
@ 2001-06-07 7:02 ` Sven Wischnowsky
2001-06-07 7:29 ` Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2001-06-07 7:02 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> bor@itsrm2% print ${foo%%=*}
> zsh: * not found
>
> Why?
Because it does expansion, include the one after an equal sign:
% echo =*
zsh: * not found
Yeah, I know, this seems silly, and I had to learn that the hard way,
too (when starting with the completion system I sometimes forgot to
quote that `=' with a backslash...).
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: ${...%%=*} problem
2001-06-07 7:02 ` Sven Wischnowsky
@ 2001-06-07 7:29 ` Andrej Borsenkow
2001-06-07 14:58 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2001-06-07 7:29 UTC (permalink / raw)
To: zsh-workers
>
> > bor@itsrm2% print ${foo%%=*}
> > zsh: * not found
> >
> > Why?
>
> Because it does expansion, include the one after an equal sign:
>
This violates our own documentation:
They are followed by _process
substitution_, _parameter expansion_, _command substitution_,
_arithmetic expansion_ and _brace expansion_ which are performed in one
step in left-to-right fashion. After these expansions, all unquoted
occurrences of the characters `\', `'' and `"' are removed, and the
result is subjected to _filename expansion_ followed by _filename
generation_.
and later
If a word begins with an unquoted `=' and the EQUALS option is set, the
remainder of the word is taken as the name of a command or alias. If a
command exists by that name, the word is replaced by the full pathname
of the command.
Granted, we do not have strict definition of ``word'' (as opposed to POSIX
:-). In this context I suspect it more like POSIX ``field''. Still, =
expansion happens after parameter substitution - not at the same time (and,
actually, here it happens even before).
-andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ${...%%=*} problem
2001-06-07 7:29 ` Andrej Borsenkow
@ 2001-06-07 14:58 ` Bart Schaefer
0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2001-06-07 14:58 UTC (permalink / raw)
To: Andrej Borsenkow, zsh-workers
On Jun 7, 11:29am, Andrej Borsenkow wrote:
} Subject: RE: ${...%%=*} problem
}
} > > bor@itsrm2% print ${foo%%=*}
} > > zsh: * not found
} > >
} > > Why?
} >
} > Because it does expansion, include the one after an equal sign:
}
} This violates our own documentation:
You're sort of correct, but you quoted the wrong section of the doc.
The relevant bit is this, under parameter expansion:
In the expansions discussed below that require a pattern, the form of
the pattern is the same as that used for filename generation; see *Note
Filename Generation::. Note that these patterns, along with the
replacement text of any substitutions, are themselves subject to
parameter expansion, command substitution, and arithmetic expansion.
That paragraph should include "filename expansion" (but not generation)
among the list of things to which the patterns are subject. So
${foo##~}
removes the home directory from $foo.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-06-07 15:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-07 6:42 ${...%%=*} problem Andrej Borsenkow
2001-06-07 7:02 ` Sven Wischnowsky
2001-06-07 7:29 ` Andrej Borsenkow
2001-06-07 14:58 ` Bart Schaefer
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).