[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#249597: texmf: Leaves spurious tempfiles around



Hilmar Preusse <hille42@web.de> wrote:

> How about:
>
> if `fmtutil --all >> $TEMPFILE`; then rm $TEMPFILE; else echo -e \
> "\nSomething went wrong. Output of initex is in $TEMPFILE."; fi

I think you really don't need the backquotes around the fmtutil call.
Also, I tend to avoid backquotes and use the $() form instead (has
simpler semantics because of the use of an opening and a closing
delimiter---some people even claim that backquotes are deprecated, but
this involves IMHO a fair amount of wishful thinking...). yes, the $()
form is perfectly endorsed by SUSv3 and thus recognized by POSIX shells.

You could also 'rm -f "$TEMPFILE"'...

> Don't know, how bash-specific that is.

'echo -e' *is* a portability problem. POSIX echo does not support any
option:

[SUSv3]

  Implementations shall not support any options.

  [...]

  It is not possible to use echo portably across all POSIX systems
  unless both -n (as the first argument) and escape sequences are
  omitted.

  The printf utility can be used portably to emulate any of the
  traditional behaviors of the echo utility as follows (assuming that
  IFS has its standard value or is unset):

  [...]

-> man 1 printf


Quick test in my sid chroot, where /bin/sh is emulated by dash:

~ % sh
%~ %# echo -e 'a\nb'
-e a
b
%~ %# /bin/echo -e 'a\nb'
a
b
%~ %#

-- 
Florent



Reply to: