string_tail

Table of Contents

Prototype: string_tail(data, max)

Return type: string

Description: Returns the last max bytes of data.

If max is negative, then everything but the first max bytes is returned.

Arguments:

  • data: string, in the range: .*
  • max: int, in the range: -99999999999,99999999999

Example:

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
      "end" string => string_tail("abc", "1"); # will contain "c"
  reports:
      "end of abc = $(end)";

}

Output:

R: end of abc = c

History: Introduced in CFEngine 3.6

See also: string_head(), string_length(), string_reverse().