Hi shell experts!
One more noob complain. Let's imagine some program opens the file with open() and the assigns its descriptor to some environmental variable, for example
char buf[80];
int fd = open(name, O_CREAT | O_WRONLY, 0666);
snprintf(buf, sizeof buf, "%d", fd);
setenv("MY_FD", buf, 1)
Then it spawns some script with fork() + execl().
Script writes the file with
echo hello >&"MY_FD"
This trick plays nice in busybox ash in TC. But another boxes with bash refuse to do so. What am I doing wrong?
Thanks in advance.