* Additional space at end of assignment in preexec's $2 and $3
@ 2014-12-09 22:51 Daniel Hahler
2014-12-10 0:23 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Hahler @ 2014-12-09 22:51 UTC (permalink / raw)
To: zsh-workers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
An assignment appears to have an additional " " at the end of $2 (and $3) in preexec:
% preexec() { echo "== preexec =="; set -x; test $1 = $2; echo $3; set +x }
% foo
=== preexec ==
+preexec:0> test 'foo=' '=' 'foo= '
+preexec:0> echo 'foo= '
foo=
+preexec:0> set +x
Please note that 1="foo=", but 2 and 3 are "foo= ".
Regards,
Daniel.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iD8DBQFUh3zvfAK/hT/mPgARAsqWAJ9bPMjZsKP+WLByg5hqTX9Zfq33FwCfUZR7
g7K0vki9ODKbLIm2prDVwVs=
=+Xau
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Additional space at end of assignment in preexec's $2 and $3
2014-12-09 22:51 Additional space at end of assignment in preexec's $2 and $3 Daniel Hahler
@ 2014-12-10 0:23 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2014-12-10 0:23 UTC (permalink / raw)
To: zsh-workers; +Cc: Daniel Hahler
On Dec 9, 11:51pm, Daniel Hahler wrote:
}
} An assignment appears to have an additional " " at the end of $2 (and
} $3) in preexec:
I believe that's because assignments by themselves are a special-case of
assignment-before-command, as far as the internal wordcode is concerned.
There is no guarantee that the user's input string and the other arguments
passed to preexec will be identical -- in fact, it's explicitly documented
that $2 will have been squashed down to a single line.
Here's a different example of whitespace changing:
torch% foo=bar :
== preexec ==
+preexec:0> test 'foo=bar :' '=' 'foo=bar :'
+preexec:0> echo 'foo=bar :'
foo=bar :
+preexec:0> set +x
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-10 0:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09 22:51 Additional space at end of assignment in preexec's $2 and $3 Daniel Hahler
2014-12-10 0:23 ` 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).