Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: subtle `echo' bug



On Wed, Jun 15, 2005 at 12:28:44AM +0000, Bart Schaefer wrote:
> In short, if you write nonsense code, you get nonsense results.  Don't
> try to feed input to a command that doesn't want it.

It was quite a real command!  It was something like:

sort -u +2 list |while read v1 v2 v3; do {
	echo "$v1 has problems with $v2..." |fmt; grep -w $v2 list; } |
	echo /path/to/my/script --opt1=$v1 --opt2="$v2...$v3"; done

My /path/to/my/script script uses both command line options and stdin.
Because the script performs some action (i.e. it is "destructive"),
I used "echo" as a comment to find out and check twice the commands that
were going to be executed.  No matter what -- it said that the script
was going to be executed only once!  After some mangling I realized that
this was rather zsh problem.

Of course my reduced version with `seq' looks like a nonsense code. :)

Attachment: pgpu6vLGTWZxh.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author