Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Order of variable substitution (any SUS guru out there?)
- X-seq: zsh-workers 18910
- From: Borzenkov Andrey <Andrey.Borzenkov@xxxxxxxxxxx>
- To: "'zsh-workers@xxxxxxxxxx'" <zsh-workers@xxxxxxxxxx>
- Subject: Order of variable substitution (any SUS guru out there?)
- Date: Mon, 28 Jul 2003 10:38:06 +0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Several times I happily removed files by doing
find . -name ... | (cd /master/rep; cpio -pmv $PWD)
the problem is apparently $PWD is evaluated only after cwd is changed so
cpio tries to copy files over themselves and removes them.
Reading SUS gives impression it is wrong. All substitutions are done
(conceptually) in one pass before any command executes. Shell here also
behaves the same:
$ find . -type f | (cd ../foo-m; cpio -pmv $PWD)
/home/bor/tmp/foo/id_dsa
/home/bor/tmp/foo/id_dsa.pub
/home/bor/tmp/foo/id_rsa
/home/bor/tmp/foo/id_rsa.pub
11 blocks
while zsh gives
bor@itsrm2% find . -type f | (cd ../foo-m; cpio -pmv $PWD)
cpio: Attempt to pass a file to itself.
cpio: Attempt to pass a file to itself.
cpio: Attempt to pass a file to itself.
cpio: Attempt to pass a file to itself.
0 blocks
4 error(s)
in this case I have sensible cpio that does not destroy target like GNU cpio
does but well ...
-andrey
Messages sorted by:
Reverse Date,
Date,
Thread,
Author