www.delorie.com/gnu/docs/m4/m4_65.html   search  
Buy GNU books!

GNU macro processor

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.4 Making names for temporary files

Commands specified to syscmd or esyscmd might need a temporary file, for output or for some other purpose. There is a builtin macro, maketemp, for making temporary file names:


which expands to a name of a non-existent file, made from the string template, which should end with the string `XXXXXX'. The six X's are then replaced, usually with something that includes the process id of the m4 process, in order to make the filename unique.


As seen in the example, several calls of maketemp might expand to the same string, since the selection criteria is whether the file exists or not. If a file has not been created before the next call, the two macro calls might expand to the same name.

The builtin macro maketemp is recognized only when given arguments.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003