${name:q}: Quote words
Escapes special characters of the variable value.
Use :x if you’d like to break into words at whitespace.
Please note that :x does not work with parameter expansion.
Links
Examples
- Quote variable value
- Output:
1 2code="echo Pattern is *.txt" echo $code:q1echo\ Pattern\ is\ \*.txt
BashSupport Pro is a Zsh IDE with support for $varName:q – try it now!