Puppet Function: shell_escape
- Defined in:
- vendor_modules/stdlib/lib/puppet/functions/shell_escape.rb
- Function type:
- Ruby 4.x API
Summary
Escapes a string so that it can be safely used in a Bourne shell command line.Overview
>* Note:* that the resulting string should be used unquoted and is not intended for use in double quotes nor in single quotes.
This function behaves the same as ruby's Shellwords.shellescape() function.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'vendor_modules/stdlib/lib/puppet/functions/shell_escape.rb', line 10 Puppet::Functions.create_function(:shell_escape) do # @param string # The string to escape # # @return # An escaped string that can be safely used in a Bourne shell command line. dispatch :shell_escape do param 'Any', :string end def shell_escape(string) require 'shellwords' Shellwords.shellescape(string.to_s) end end |