${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 2
code="echo Pattern is *.txt" echo $code:q
1
echo\ Pattern\ is\ \*.txt
BashSupport Pro 是一款支持 q** 的 **Zsh 集成开发环境 - 立即试用!