Puppet Function: shellescape

Defined in:
puppet/modules/wmflib/lib/puppet/parser/functions/shellescape.rb
Function type:
Ruby 3.x API

Overview

shellescape()Any

Escapes a string so it can be used as a shell argument (wraps it in single quotes and deals with any single quotes inside).

Returns:

  • (Any)


10
11
12
13
14
15
16
17
18
# File 'puppet/modules/wmflib/lib/puppet/parser/functions/shellescape.rb', line 10

newfunction(:shellescape, :type => :rvalue, :doc => <<-EOS
  Escapes a string so it can be used as a shell
  argument (wraps it in single quotes and deals
  with any single quotes inside).
  EOS
) do |args|
  raise(Puppet::ParseError, 'shellescape(): Wrong number of arguments') if args.length != 1
  shellescape(args[0])
end