[petsc-dev] printf versus echo -e/-n
Jed Brown
jedbrown at mcs.anl.gov
Sat Oct 20 11:15:54 CDT 2012
On Sat, Oct 20, 2012 at 10:59 AM, Matthew Knepley <knepley at gmail.com> wrote:
> On Sat, Oct 20, 2012 at 11:46 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>>
>> https://bitbucket.org/petsc/petsc-dev/changeset/26de1ead89b9285efb27a8689180876aa83921a5
>>
>>
>> http://stackoverflow.com/questions/11530203/what-is-more-portable-echo-e-or-using-printf
>
>
> Okay, I will bite. Why would you use the clearly less portable solution?
>
I was pointing out that PETSc uses echo in many places. I think Satish's
new use of echo -e will be an issue somewhere, so we should use printf
there. Also, all the run targets use echo without a flag, but with \n in
the string. This is not escaped. You'll see that I started using printf for
such examples.
$ grep 'printf' src/**/makefile
src/mat/examples/tests/makefile: ${DIFF} output/ex38_1.out
ex38_1.tmp || printf "${PWD}\nPossible problem with ex38_1, diffs above
\n========================================="; \
src/mat/examples/tests/makefile: ${DIFF} output/ex38_2.out
ex38_2.tmp || printf "${PWD}\nPossible problem with ex38_2, diffs above
\n========================================="; \
src/mat/examples/tests/makefile: ${DIFF} output/ex38_2.out
ex38_2.tmp || printf "${PWD}\nPossible problem with ex38_3, diffs above
\n========================================="; \
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20121020/da730260/attachment.html>
More information about the petsc-dev
mailing list