At least in bash pattern substitution following quotes are often used: $' '
For example ${arr[@]/%/$'\n\n\n'}
prints three newline characters after each array "arr" item. Are those some sort of special quotes? How are they called? Where are they used besides bash pattern substitution?
ANSI-C Quoting
Words of the form
$'string'
are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard.
For example:
$'hello\nworld'
You'll get 11
characters with newline in the middle.
echo -e 'hello\nworld'
echo $'hello\nworld'
They give you the same result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With