6

I recently read some bash code, echo $"asdf", what is $ for?

What is the difference between $"asdf" and just "asdf"?

codeforester
  • 34,080
  • 14
  • 96
  • 122
nfpyfzyf
  • 2,771
  • 6
  • 24
  • 28
  • 1
    Possible duplicate of [What are the special dollar sign shell variables?](https://stackoverflow.com/questions/5163144/what-are-the-special-dollar-sign-shell-variables) and [What does it mean to have a $“dollarsign-prefixed string” in a script?](https://unix.stackexchange.com/questions/48106/what-does-it-mean-to-have-a-dollarsign-prefixed-string-in-a-script) – Andre Figueiredo Aug 10 '17 at 16:57

1 Answers1

11

As documented in the bash manual, it is used for localization:

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.

dogbane
  • 254,755
  • 72
  • 386
  • 405