[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mktemp and suffixes
From: |
Jim Meyering |
Subject: |
Re: mktemp and suffixes |
Date: |
Mon, 22 Mar 2010 15:58:39 +0100 |
Nuno J. Silva wrote:
> In a BASH script I'm writing, I need temporary files. Unfortunately, not
> only some of the used programs don't accept stdin nor stdout, but they
> also require "extensions" on the input/output file.
>
> As I want to be sure nothing is overwritten, I tried calling mktemp with
> a modified template:
>
> $ mktemp tmp.XXXXXXXXXX.ext
> mktemp: too few X's in template `tmp.XXXXXXXXXX.ext'
>
> Which is just the default template with some more characters appended,
> that is, the amount of X's is the same. I even tried with more and more
> X's and it still didn't work, so I gave up, as the problem must be
> something else.
>
> Is this a limitation of mktemp (X's must be on the right)? Or am I
> missing some parameter? --suffix=.ext (seen on the web) doesn't work.
>
> (And the version is 7.5:)
Upgrade to coreutils-8.1 or newer (latest is 8.4).
mktemp gained the --suffix=SUFF option in 8.1:
--suffix=SUFF append SUFF to TEMPLATE. SUFF must not contain slash.
This option is implied if TEMPLATE does not end in X.