> > Are you sure that $$ is always preserved across subshells? What it I
> > create conf$$ in a subshell but want to access it in the top level shell?
>
> Sorry, but I don't understand why you are referring to subshells here.
> If anyway we were actually playing with subshells, we'd be in trouble
> to have the subshell pass relevant information to the mother, who is
> the one who wants information.

Unless you are using files with known names.

> Please develop.

Maybe it's too primitive, but I hope you will get the idea:

(
# Do it in subshell to avoid saving all variables
cat >conf$$.c <<EOF
$1
EOF
CFLAGS="$CFLAGS -fnord"
LIBS="$LIBS -lol"
$CC $CFLAGS $LIBS -o conf$$ conf$$.c
./conf$$ >conf$$.val
rm -f conf$$ conf$$.c
)
ac_result=`cat conf$$.val`
rm -f conf$$.val

Regards,
Pavel Roskin


Reply via email to