Very interesting indeed. I find the mailing-list is really good place where developers can learn a variety of stuff. I tested the two scripts with bash, the results are effectively the same. It seems that $(. XXX) does try to evaluate the output from XXX, but does not do it very well.
--- root@OpenWrt:/tmp# cat hello.sh #!/bin/sh echo 'echo "Hello World!" ; exit 8' root@OpenWrt:/tmp# cat source.sh #!/bin/sh $(. /tmp/hello.sh) exit 9 root@OpenWrt:/tmp# sh ./source.sh "Hello World!" ; exit 8 root@OpenWrt:/tmp# echo $? 9 root@OpenWrt:/tmp# sh hello.sh echo "Hello World!" ; exit 8 Modify hello.sh, try again with printf: root@OpenWrt:/tmp# cat hello.sh #!/bin/sh echo 'printf "Hello %s!" "World" ; exit 8' root@OpenWrt:/tmp# sh ./source.sh "Helloroot@OpenWrt:/tmp# echo $? 9 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
