Created SC2039 (markdown)

David A. Wheeler
2013-12-01 08:06:49 -08:00
parent 0ec8848992
commit 9b3e0d6e1e

6
SC2039.md Normal file

@@ -0,0 +1,6 @@
The $'...' construct is widely supported and in the process of being standardized, but it is not yet standard. Many shells do support it, including bash, ksh, zsh, and the busybox "sh" command. Since it is useful, POSIX has recently accepted $'...' (see http://austingroupbugs.net/view.php?id=249 ). However, POSIX-2013 does not include $'...', so a few shells do not yet support it. For now, be more specific about the shell, or use another construct (printf can often do the job).
The $(...) construct strips trailing newlines. You can retain trailing newlines using this trick:
newline="$(printf '\nX')"
newline="${newline%X}