Timeline for What does it mean to have a $"dollarsign-prefixed string" in a script?
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 26, 2023 at 2:29 | comment | added | jw013 | @Palec This is for human language translation but in order for it to work you have to go through a lot of steps to set up translation files. More info under Creating Internationalized Scripts which for some reason is missing from the link above. | |
| May 25, 2023 at 20:03 | comment | added | Palec | Do you have any example of when $"..." is useful? I found the docs, too, but I do not really understand what they say. What does it mean to translate a string according to the current locale? I know what locale is, BTW. | |
| Mar 28, 2022 at 17:56 | comment | added | Sridhar Sarnobat | Ah yes I remember that Chinese characters' escape codes can be tab completed if you use dollar syntax. Thanks | |
| Mar 28, 2022 at 16:46 | comment | added | UrsineRaven | @SridharSarnobat, Another difference is: "$variable\n" will result in the contents of the variable followed by a newline, whereas $'$variable\n' will result in $variable followed by a newline. So, if you want to avoid escaping dollar signs and double quotes in a string and still be able to escape single quotes (for example if you are passing a complex command to a specific shell from within a bash script), then $'' is the way to go. | |
| May 17, 2021 at 14:45 | comment | added | domen | "" does not interpret that much. Try $'\x31' vs. "\x31". | |
| Jan 20, 2021 at 21:41 | comment | added | Sridhar Sarnobat | I think the behavior of "\n" vs $'\n' is different but I'm still confused. | |
| Jan 20, 2021 at 21:39 | comment | added | Sridhar Sarnobat | Thanks for the example. What I don't understand is - why did ANSI support $'' when you can just use ""? I'm sure there's a reason and for my understanding it would be good to know. | |
| Jun 11, 2020 at 12:04 | history | edited | CommunityBot | Commonmark migration | |
| Sep 14, 2012 at 19:29 | vote | accept | Ed Brannin | ||
| Sep 13, 2012 at 22:51 | history | answered | jw013 | CC BY-SA 3.0 |