The $ in the beginning of the string in :
echo $'Hello World\nThis is a new line'
causes escape sequences to be interpreted.
Bash reference manual [ says ]
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.
..
..
The expanded result is single-quoted, as if the dollar sign had not been present.
But
echo $"Hello World\nThis is a new line"
is completely different. This [ article ] on locale specific translation says :
A double-quoted string preceded by a dollar sign (‘$’) will cause the
string to be translated according to the current locale. If the
current locale is C or POSIX, the dollar sign is ignored. If the
string is translated and replaced, the replacement is double-quoted.
Note: IIRC both $'string' and $"string" as bashisms [ needs validation ]. Not only do people from other shells look at them curiosity but also they debate on whether this could be avoided for script portability.
"weak quote"and'strong quote'are different from$'C String'and$"I18N String". – DopeGhoti 3 hours ago