BBC.SHARED.JOBI.TEMPFILE-ADD

Summary

Object type
JOBI
Object Folder
PACKAGES/BEST-BLU/BBC.SHARED/SOURCE/TEMPFILES
Title
Adds text to a temporary file
Archive Key 1
-
Archive Key 2
-
Created
WRITER/B4A am: 2022-02-28 14:47:19
Last Modified
WRITER/B4A am: 2024-01-09 09:57:42 18 x
Last Used
-

Description

This include adds a line to a temporary file that has been created with the include BBC.SHARED.JOBI.TEMPFILE_CREATE

Requirements

  • Unix: bash
  • Windows: Powershell 7.0

Parameter

$ENTRY$
defines the line to add to the temporary file

Input

Output

Unix

$bbcs_temp_file
script variable containing the name of the temporary file

Windows

$bbcs_temp_file
powershell variable containing the name of the temporary file

Example

:include BBC.SHARED.JOBI.TEMPFILE-ADD $ENTRY$ = "<value>"

Process

:switch &$PLATFORM#
:case "UNIX"
:  set &item# = resolve_var( "$ENTRY$" )
:set &quoted# = "'"
:set &quoted# = str_cat( &quoted#, '"' )
:set &quoted# = str_cat( &quoted#, "'" )
:set &quoted# = str_cat( &quoted#, '"' )
:set &quoted# = str_cat( &quoted#, "'" )
:set &item# = str_sub( &item#, "'", &quoted# )
echo '&item#' >> $bbcs_temp_file
:case "WINDOWS"
:  inc BBC.SHARED.JOBI.ESCAPE4POWERSHELL $STRING$ = "$ENTRY$"
"&BBCS_ESCAPED_STRING_O#" | Add-Content $bbcs_temp_file.fullName
:other
:  p "unsupported platform &$PLATFORM#"
:endswitch