${(Q)…}: Remove one level of quotes

Q removes one level of quotes from the resulting words.

Examples

Remove quotes
1
2
3
4
5
6
double_quoted="\"'double quoted string'\""
echo ${double_quoted}
# remove one level of quotes
echo ${(Q)double_quoted}
# remove two levels of quotes
echo ${(Q)${(Q)double_quoted}}
Output:
1
2
3
"'double quoted string'"
'double quoted string'
double quoted string
BashSupport Pro 是一款支持 Q** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款