"eval" is in background? 

Newsgroups: comp.unix.shell
> >       echo done retrieval. >&2
>                             ^^^   That's the culprit.
>
>">&" is a csh-ism.

An addendum: * Tong *'s OP claimed that bash was being used; in that case >&2 is perfectly legitimate for routing both stdout and stderr to the file named "2" (though even then the preferred bash syntax is &>2). But he also said that the script started with !/bin/sh, which is _not_ appropriate for invoking bash, even if /bin/sh is a symlink to bash on the system. If you expect the script to be interpreted by bash, then say so in the shebang line: !/bin/bash .

Ken Pizzini