run-tests: bugfix on mktemp

Alexis S. L. Carvalho alexis at cecm.usp.br
Thu Jul 28 15:58:47 UTC 2005


Thus spake Aron Griffis:
> Radoslaw AstralStorm Szkodzinski wrote:	[Thu Jul 28 2005, 10:49:15AM EDT]
> > On Thu, 28 Jul 2005 10:38:52 -0400
> > Aron Griffis <agriffis at gentoo.org> wrote:
> > 
> > > 
> > > No.  ${TMP:-/tmp} is a bash/ksh extension.  ${TMP-/tmp} is Bourne
> > > shell and should be used anywhere you care about compatibility.
> > > 
> > > There is also a semantic difference.  ${TMP:-/tmp} uses the default
> > > value if ${TMP} is unset.  ${TMP-/tmp} uses the default value if
> > > ${TMP} is unset *or* empty.  In this case you clearly want the latter.
> > 
> > So my doc is bash-specific. How evil. Now I have to fix about 10 scripts
> > because of this. :)
> 
> FWIW, I had it backwards:
> 
>     ${TMP:-/tmp} => default if unset or empty
>     ${TMP-/tmp}  => default if unset
> 
> Nonetheless, as long as it's #!/bin/sh, the compatible one is
> ${TMP-/tmp}

Are you sure?  AFAICS Posix defines both:

http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02

And (in Debian) both dash and bash accept both.

Alexis



More information about the Mercurial mailing list