9.4.6 adshmktemp command (creates a file for which the file name is not duplicated)
Syntax
adshmktemp prefix
Description
This command creates a file with a name that is not duplicated and outputs the path name to the standard output.
The name of the path of the file to be created is follows:
Temporary-file-directory-path-name prefix_job-ID_process-ID_time-information_file-sequence-number
- Temporary-file-directory-path-name
-
Path name of the directory defined with the TEMP_FILE_DIR parameter.
- prefix
-
Prefix specified for argument.
- job-ID
-
6-digit job ID in decimal. If the number of digits of the job ID is less than 6, add 0 at the beginning to make a 6-digit ID.
- process-ID
-
Process ID in decimal. If the number of digits of the job ID is less than 5, add 0 at the beginning to make a 5-digit ID. If the number of digits is not less than 5, leave the value as it is.
- time-information
-
Character string of numerical value representing time information in hexadecimal.
- file-sequence-number
-
Sequence number of the file path name created in one process. A character string of 4-digit in decimal from 0001 to 4095.
You can create a file in one process until the file sequence number exceeds 4095.
In UNIX, for permission for the file to be created, only owner (creator) of a file is specified by the umask value and 0 is always set for access privilege of group and other users.
In Windows, permissions are not specified.
Arguments
- prefix ~<any character string>((1 to 128 bytes))
-
Prefix specifies a character string to be provided at the beginning of the file name.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
1 |
Termination with an error |
Notes
-
If the created file path name exceeds the maximum number of bytes of the path name permitted by OS, the command finishes with an error.
-
If you specify the character string including the following characters for the prefix of argument, the command terminates with an error.
In UNIX: "/"
In Windows: "/", "\" and ":"
-
Do not specify the character that cannot be used as a path name for the prefix of argument. If these characters are specified, creation of a file fails.
Examples
#If the default value is set for the TEMP_FILE_DIR parameter in the UNIX edition: adshmktemp testjob # The following file is created and the path name is output to the standard output: /var/opt/jp1as/temp/testjob_000150_12278_557539f8_0001 #If the default value is set for the TEMP_FILE_DIR parameter in the Windows edition: adshmktemp testjob # The following file is created and the path name is output to the standard output: E:\temp\testjob_000030_00826_55265a48_0002 # Specify the file for the adshfile command and output the character string by using the echo command. #The adshfile command deletes the file when the job finishes. tempfile=$(adshmktemp job1) "${ADSH_DIR_BIN}adshfile" -n del -a del "$tempfile" echo "OK" > "$tempfile"