I have been doing some work on trying to correct errors in the ant shell script with how special characters and whitespace and handled in arguments.
I have a scratch branch in github. I do forced pushes as I clean it up and try new things, so beware forking. https://github.com/jwadamson/ant-1/tree/shell-detection I do trials by running a script test.sh: #!/bin/sh ./bin/ant --execdebug \ "-Dfoo=dollar\$_backtick\`_single'_double\"\"_trailingbackslash\\" \ "-Dbar=trailingnewline " \ "-Dnewline= " \ "-Ddoublespace= " \ "-Dx=y" \ "-f" "test.xml" where test.xml is simply <project default="run"> <target name="run"> <echo message="hello world"/> <echo message="foo=${foo}_"/> <echo message="bar=${bar}_"/> <echo message="newline=${newline}_"/> <echo message="doublespace=${doublespace}_"/> <echo message="end"/> </target> </project> The trailing _ characters are so that echo task does not trim the output for trailing whitespace scenarios. The only solution I have found to date that avoids all behavior quirks such as echo, sed, awk, and whitespace handling is a bashism/ksh-ism. So that does not work for ubuntu's /bin/sh. I have not figured out a universal correct script for dash (ubuntu) yet. It may be worth detecting bash to leverage that, and call other things "close enough" :-(. I have run the script with bash, ksh, and dash under Ubuntu and Mac. Csh and tcsh do not seem to work (do we expect them to?) I do not have an HP-UX or Solaris setup yet (though there are vbox images for Solaris). I may not have much time for more testing today, but would appreciate any advise: 1) from people with Solaris and HP-UX and AIX 2) thoughts on introducing shell detection and bashisms into the script 3) how to do a clean string substitution or sed/awk based replacement that doesn't munge newline and trailing spaces 4) anything else that appears fishy in the test cases Regards, Jeff Adamson