Movatterモバイル変換


[0]ホーム

URL:


CFEngine documentation homepage

basename

Suggest changes
Table of contents

Prototype:basename(filename, optional_extension)

Return type:string

Description: Retrieves the basename of a filename.

This function implements the same behavior of basename program on Unix and Unix-like operating systems.

Arguments:

  • filename:string - File path - in the range:.*
  • optional_extension:string - Optional suffix - in the range:.*

Example:

code
bundleagentmain{vars:"basename"->{"CFE-3196"}string=>basename($(this.promise_filename));"basename_wo_extension"->{"CFE-3196"}string=>basename($(this.promise_filename),".cf");reports:"basename = '$(basename)'";"basename without '.cf' extension = '$(basename_wo_extension)'";}
code
R: basename = 'basename.cf'R: basename without '.cf' extension = 'basename'

This policy can be found in/var/cfengine/share/doc/examples/basename.cfand downloaded directly fromgithub.

History:

  • Introduced in 3.15.0

Still need help?

Chat Ask a question on Github Mailing list
Version 
master3.24 (LTS)3.21 (LTS)view all versions

[8]ページ先頭

©2009-2025 Movatter.jp