Yash-quote
yash-quote is a Rust library crate for quoting strings used in a POSIX shell script.
This crate provides just one function: quote. It returns a quoted version of the argument string.
Usage
Add yash-quote as a dependency in your Cargo.toml.
use ;
use quote;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
License
MIT or Apache 2.0, at your option
Similar crates
r-shquoteprovides a function that always quotes using single quotes.- The
quotefunction of theshell_wordscrate is similar but tries to return the argument unchanged if possible. Unlikeyash-quote, it only supports ASCII characters. snailquoteis also similar but uses an original format that is not fully compatible with POSIX shells.shell_quotereturns a string escaped using Bash's$'...'notation.
For the reverse operation of quote, the yash-syntax crate provides the unquote function.