diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh
index 45f08df38fecbb18491a4547a41dd1863bd56030..a09395c9e00499984e0157d57c3d261863407607 100755
--- a/tools/buildgen/generate_projects.sh
+++ b/tools/buildgen/generate_projects.sh
@@ -46,13 +46,11 @@ end2end_test_build=`mktemp /tmp/genXXXXXX`
 $gen_build_json > $end2end_test_build
 
 global_plugins=`find ./tools/buildgen/plugins -name '*.py' |
-  sort | grep -v __init__ |
-  while read p ; do echo -n "-p $p " ; done`
+  sort | grep -v __init__ | awk ' { printf "-p %s ", $0 } '`
 
 for dir in . ; do
   local_plugins=`find $dir/templates -name '*.py' |
-    sort | grep -v __init__ |
-    while read p ; do echo -n "-p $p " ; done`
+    sort | grep -v __init__ | awk ' { printf "-p %s ", $0 } '`
 
   plugins="$global_plugins $local_plugins"
 
@@ -60,7 +58,7 @@ for dir in . ; do
     out=${dir}/${file#$dir/templates/}  # strip templates dir prefix
     out=${out%.*}  # strip template extension
     json_files="build.json $end2end_test_build"
-    data=`for i in $json_files; do echo -n "-d $i "; done`
+    data=`for i in $json_files ; do echo $i ; done | awk ' { printf "-d %s ", $0 } '`
     if [ "x$TEST" = "xtrue" ] ; then
       actual_out=$out
       out=`mktemp /tmp/gentXXXXXX`