Skip to main content

shell_escape

Function shell_escape 

Source
pub fn shell_escape(s: &str) -> String
Expand description

Escape a string for safe inclusion in a single-quoted shell argument.

The POSIX approach: wrap in single quotes, and for any embedded single quote, end the current quoting, insert an escaped single quote, and restart quoting: ''\''.

Returns the string with surrounding single quotes.