${(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 ist eine Zsh IDE mit Unterstützung für ${(Q)…} - probieren Sie es jetzt aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches