[petsc-dev] printf versus echo -e/-n
Jed Brown
jedbrown at mcs.anl.gov
Sat Oct 20 11:44:10 CDT 2012
On Sat, Oct 20, 2012 at 11:28 AM, Satish Balay <balay at mcs.anl.gov> wrote:
> printf is more portable. It should always be preferred over echo -e. If
> targeting bash/zsh/ksh
> <<<<
>
> is printf portable with bourne shell aswell?
>
You have chosen to split the quote in a very peculiar way. Putting the
sentences on separate lines should help clarify
*'''
printf is more portable.
It should always be preferred over echo -e.
If targeting bash/zsh/ksh specifically, echo $'...' is also ok.
If targeting zsh or ksh specifically, print is ok.*
*'''*
Look at the table here: http://www.in-ulm.de/~mascheck/various/echo+printf/
There hasn't been an OS without printf since the 1980s.
"New applications are encouraged to use printf instead of echo."
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html#tag_20_37_16
> Because thats what we target.
>
> I don't really need '-e' there. Instead of
>
> >>>
> mpif90 -show: ln -s /sandbox/petsc/software/mpich-1.2.7p1/include/mpif.h
> mpif.h
> ifort -L/sandbox/petsc/software/mpich-1.2.7p1/lib -lmpichf90 -lmpich
> -lpthread -lrt
> rm -f mpif.h
> <<<
> I can do with:
>
> >>>
> mpif90 -show: ln -s /sandbox/petsc/software/mpich-1.2.7p1/include/mpif.h
> mpif.h (newline) ifort -L/sandbox/petsc/software/mpich-1.2.7p1/lib
> -lmpichf90 -lmpich -lpthread -lrt (newline) rm -f mpif.h
> <<<
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20121020/c84dc21c/attachment.html>
More information about the petsc-dev
mailing list