In various bash scripts I have come across the following: $\'\\0\'
An example with some context:
while read -r -d $\'\\0\' line; do
ec
$'\0'
expands the contained escape sequence \0
to the actual characters they represent which is \0
or an empty character in shell.
This is BASH syntax. As per man BASH
:
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. Known backslash escape sequences are also decoded.
Similarly $'\n'
expands to a newline and $'\r'
will expand to a carriage return.