Skip to main content

shell_quote

Function shell_quote 

Source
pub fn shell_quote(path: &str) -> String
Expand description

POSIX-shell-quote a path for inclusion in a copy-pasteable command.

Returns the bare path when it’s a safe identifier; otherwise wraps it in single quotes (escaping any embedded single quote via the standard '\'' trick). Keeps the common case (cd /tmp/scratch) clean while staying correct for spaces, parens, $, etc.