A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.cfengine.com/latest/reference-functions-readfile.html below:

readfile - CFEngine 3.26 Docs

Prototype: readfile(filename, optional_maxbytes)

Return type: string

Description: Returns the first maxbytes bytes from file filename. maxbytes is optional, if specified, only the first maxbytes bytes are read from filename. When maxbytes is 0, inf or not specified, the whole file will be read (but see Notes below).

Arguments:

Example:

Prepare:

code

echo alpha > /tmp/cfe_hostlist
echo beta >> /tmp/cfe_hostlist
echo gamma >> /tmp/cfe_hostlist

Run:

code

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

bundle agent example
{
  vars:

      "xxx"
      string => readfile( "/tmp/cfe_hostlist" , "5" );
  reports:
      "first 5 characters of /tmp/cfe_hostlist: $(xxx)";
}

Output:

code

R: first 5 characters of /tmp/cfe_hostlist: alpha

Notes:

History:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4