Mktemp – Visara Master Console Center Scripting Guide User Manual
Page 149
Chapter 5 Script Commands
Scripting Guide
149
MKTEMP
Syntax:
MKTEMP($Pattern) ==> $FileName
Description:
Returns a unique file name.
Action:
Creates a file name based on the given pattern that is
guaranteed to be unique (not used) at the time of
creation. This is intended for use in situations where a
temporary file name is needed. Please note that
MKSTEMP is preferred to avoid race conditions.
MKTEMP is provided for backward compatibility.
Parameters:
$Pattern: String expression. This is a filename with
some number of 'Xs' appended to it. The 'Xs' will be
replaced with letters and numbers so that the
filename is unique.
Returns:
String value, unique file name (or am empty string on
failure)
Example:
$TempFileName := MKTEMP("/tmp/fooXXXXXX")
$Command := "ls -la > " + $TempFileName
%rc := SYSEXEC( $Command )
IF ( %rc >= 0 )
%Handle := FOPEN( $TempFileName )
IF ( %Handle != ERROR )
%rc := FREAD( %Handle, $Temp )
IF ( %rc >= 0 )
LOG( LOG_FLT, "First line is " + STR(
$Temp ), 8)
ENDIF
ENDIF
ENDIF
See Also: