unfamiliar quoting convention in a bash script
I'm trying to debug a bash script on macos. The business end of the script is just:
$JAVA_COMMAND $CLASS $*
The command line includes /a/b/d/*, where the files in /a/b/d have names in Arabic.
When I run with sh -x, each of those files is echoed as $'/a/b/c/thearabic'
Where does the开发者_StackOverflow $' convention come from, and what does it mean?
From the Bash man page:
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. Backslash escape sequences, if present, are decoded as follows:
...
The expanded result is single-quoted, as if the dollar sign had not been present. 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.
man page
精彩评论